Required Variables

The key to incorporating relevant ads into your application is providing Millennial Media with key values that help identify the device, carrier and country.

####Each of the parameters listed below is required to serving ads.

Parameter Description
APID The Ad Placement ID
HAID Hashed Advertising Identifier (IDFA) for iOS
MMDID Hashed MAC Address for iOS
UA User Agent
UIP The User’s Public IP Address

For more on finding and hashing any of the IDs below, please see finding and hashing IDs under References.

Ad Placement ID (apid)

This value is a unique identifier provided by Millennial Media that needs to be included in every request to provide site metrics back to the Publisher. Without the Placement ID, you will not receive any ad units.

Hashed Advertising Identifier (haid)

This is the preferred identifier for iOS users with versions 6 and up.

The IDFA needs to sent using the MD5 and SHA-1 hash and appending “mmh_” to generate a string with the format of mmh_[MD5]_[SHA1].

Example:

...haid=mmh_80B2AEF0134242A831D6025B0558BD84_4585EAA5E86BBD2E476320EB1D55E9B1A7BABA4F&..

NOTE: The instructions in finding and hashing IDs will obtain the values in the reqired format.

Hashed MAC Address (mmdid)

This is the preferred identifier for iOS users with versions prior to 6.

The WiFi MAC Address is 12 alphanumeric characters that are specific to that device and should be sent in the mmdid field using the MD5 and SHA1 hash and appending “mmh_” to generate a string with the required format of mmh_[MD5]_[SHA1].

Example:

...mmdid=mmh_80B2AEF0134242A831D6025B0558BD84_4585EAA5E86BBD2E476320EB1D55E9B1A7BABA4F&..

NOTE: More information on hashing the MAC Address.

User Agent (ua)

This value is used to determine device characteristics.

This value is the UA string of the device browser used to determine the handset making the request. Having the UA enables us to determine certain device characteristics in order to provide the correct ad unit for the request.

In order to determine the UA string of the device browser, we utilize the HTTP_USER_AGENT HTTP header to insert the proper UA string into the ad request.

Note: If you have an internal server in between the handset and this server, you will need to forward the proper UA string into the ad call.

Public IP Address (uip)

This identifier is used to identify the country and carrier of the device.

This value is the Public IP address of the device requesting the ad unit. Private IP addresses on WiFi networks will NOT get identified and thus will not get served ad units.

The integration code provided in the mMedia portal extracts the Public IP address of the device by utilizing the REMOTE_ADDR HTTP header.

Note: If you have an internal server in between the handset and this server, you will need to utilize the X_FORWARDED_FOR HTTP Header in order to obtain the Public IP address of the device.

Provided below is an example of a complete ad request with all the required parameters (Please note the values below are examples only):

...
http://ads.mp.mydas.mobi/getAd?apid=12345&haid=mmh_80B2AEF0134242A831D6025B0558BD84_4585EAA5E86BBD2E476320EB1D55E9B1A7BABA4F&mmdid=mmh_66B2AEF0134242A831D6025B0558BD84_8885EAA5E86BBD2E476320EB1D55E9B1A7BABA4F&ua=Mozilla%2F5.0%20(iPhone%3B%20CPU%20iPhone%20OS%206_1%20like%20Mac%20OS%20X)%20AppleWebKit%2F536.26%20(KHTML%2C%20like%20Gecko)%20Mobile%2F10B141&uip=38.118.54.10
...

Metadata

Metadata may also be passed during the ad request. To learn more, see Metadata.

For More Information

If you have any questions, please contact us to reach a trained support professional.