Server-Side
This implementation allows developers with the access to embed web objects into their application to utilize standard Web ad tags to incorporate advertisements within their applications. This implementation requires the application developer to embed a browser-like object into their application to simulate a browser on the device outside of the application. For iPhone developers, it is a UI View and this simulates the Safari browser inside the application.
In addition, we are able to provide XML or HTML responses for application developers to parse if the developer is unable to embed a web object into their application.
In addition, for an application that wants to embed multiple ad networks into their application, this may be the best approach instead of utilizing a specific SDK to embed ads. This approach will allow a developer to utilize a server-side code of their choosing to make ad calls into the Millennial network.
Contents |
Required Variables
The key to providing relevant ads into your site or application is to provide Millennial Media with key values that will help us determine Country, Carrier, Handset, and uniquely identify the user when requesting ads. Each of these parameters is critical to serving ads correctly and is discussed in further detail below.
AUID
This value is used to uniquely identify a user when requesting an ad. This is used for frequency capping and other types of reach analytics needed by many advertisers.
Because application developers have access to much more device information than Web applications, it is desired that the publisher pass in the unique device identifier as the AUID value.
For BlackBerry devices, the PIN is obtained in the following manner:
java.lang.Integer.toHexString(DeviceInfo.getDevice Id())
For Android device, the device ID is obtained in the following manner:
String deviceId = Settings.System.getString(this.getContentResolver(), Settings.System.ANDROID_ID);
if( deviceId == null )
{
throw new RuntimeException("This application will not run on the Emulator");
}
Public IP Address
This value is the Public IP address of the device that is requesting the ad unit. This allows Millennial Media to identify the country and carrier of the device. Private IP addresses on WiFi networks will NOT get identified and thus will not get served ad units.
The code below is able to extract the Public IP address of the device by utilizing the REMOTE_ADDR HTTP header. This code requires that the code reside on a server that is directly communicating with the handset. 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.
UA String
This value is the UA string of the device browser. This value is used to determine the handset that is making the request and allows Millennial Media to determine certain device characteristics in order to provide the correct ad unit for the request. Without the UA string, Millennial Media is unable to determine what type of device is making the request and can exclude the request for a certain campaign that is targeted to a specific device.
As a result, device detection is required from the developer's side to properly identify the device and pass the correct UA string into the ad call to our ad servers. By doing so, Millennial will be able to properly target campaigns appropriately.
Customarily, it is appropriate to pass in the Manufacturer and Model of the device if you are in the application namespace and we will be able to identify the phone.
BlackBerry Developers
For BlackBerry developers, it is required that you send in the vendor ID from the device in order for Country and Carrier detection to be performed properly. This is due to the fact that all IP traffic is routed through RIM servers, as such, this will cause identification issues for your application if you do not pass in the vendor ID on the ad call. Below is an example of the UA with the vendor ID inside the user agent, as well as code snippets on how to build the user agent string from your application.
BlackBerry8100/4.2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100
Code Sample
public static String getUserAgent()
{
StringBuffer sb = new StringBuffer();
sb.append("BlackBerry");
sb.append(DeviceInfo.getDeviceName());
sb.append("/");
//#ifdef JDE_4_5_0|JDE_4_7_0|JDE_5_0_0
sb.append(DeviceInfo.getSoftwareVersion());
//#else
sb.append("4.2.1");
//#endif
sb.append(" Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/");
sb.append(Branding.getVendorId());
return sb.toString();
}
Placement ID
This value is a unique identifier provided by Millennial Media and needs to be provided in every request in order to provide site metrics back to the Publisher. Without the Placement ID, you will not receive any ad units. Metadata: Many publishers are asking their users to register and provide demographic and psychographic information. Millennial Media leverages the value of the anonymous information collected by our publishers about their users. We call this information metadata. The most frequently-used examples of this metadata are age, gender and zip code. Each section below describes the different methods to pass this information, whether you are a site or an application.
Metadata
By adding lines to your code, you can provide age, gender, zip code or other information that you’ve gathered about your users. This can be done by simply appending &variable=value to your code. In the table below, you’ll see different variables that you are able to pass into the Millennial Media ad infrastructure.
| Variable | Example Values |
| age | 23 |
| gender | male |
| zip | 90210 |
| marital | single |
| income | 100,000 |
| lat | 32.0678 |
| long | 101.089 |
Below is an example of passing age, gender, zip, and lat/long in our infrastructure during a standard ad request.
http://ads.mp.mydas.mobi/getAd.php5?apid=357&auid=63.145.58.2&ua=Mozilla%2f5.0+(Windows%3b+U% 3b+Windows+NT+5.1%3b+en-US%3b+rv%3a1.8.1.8)+Gecko%2f20071008+Firefox%2f2.0.0.8& uip=63.145.58.2&age=23&gender=male&zip=90210&lat=32.0678&long=101.089
Other variables can also be provided. For example, some Publishers have asked their users to provide marital status, annual income, political affiliation, product preferences or other information. In this example, I’ve included marital status and income.
http://ads.mp.mydas.mobi/getAd.php5?apid=357&auid=63.145.58.2&ua=Mozilla%2f5.0+(Windows%3b+U% 3b+Windows+NT+5.1%3b+en-US%3b+rv%3a1.8.1.8)+Gecko%2f20071008+Firefox%2f2.0.0.8&uip= 63.145.58.2&age=23&gender=male&zip=90210&marital=single&income=100000&lat=32.0678&long=101.089
If you’d like to pass along additional information, you may do so by informing your Millennial Media Publisher Services Representative of the information you’d like to provide and the name that you’ve given to the value you’re providing.
Mediation Layers
We work with several Mediation partners to deliver ads within your website or application. Most notably, DART and Atlas; however, we support a plethora of other mediation layers. To inquire about who we work with to provide mobile ads to your inventory, please contact your Publisher Services representative.
Response Types
As mentioned above, we are able to provide developers both an HTML response and an XML response based on the needs of the developer.
HTML
The HTML response is perfect for developers that are able to embed a browser-like object within their application, much like a UIWebView for the iPhone. These types of objects are able to render the HTML with the object itself, much like a web browser would handle HTML. As a result, no parsing of the response is necessary for it to display correctly within the application.
The two responses below are examples of HTML responses. The first is a standard banner ad response, and the later is a HTML response with JavaScript embedded for Rich Media creatives. In order to support Rich Media your application must support browser-like objects and must be able to be changed dynamically based on the creative interaction and resizing.
Banner Ad Response
<a href="http://bank18.clicks.mp.mydas.mobi/handleClick.php5?apid=357&acid=1027& auid=4234082072eec26db95af554fb953029&osid=18&urid=47ecd206e6e659fc5c0840d1f53d2814 &ri=18&mmid=2957&uip=38.118.54.2&orut=1247243737"> <img src="http://bank18.ads.mp.mydas.mobi/getImage.php5?apid=357&mode=live&acid=1027& auid=4234082072eec26db95af554fb953029&osid=18&urid=47ecd206e6e659fc5c0840d1f53d2814& ri=18&mmid=2957&orut=1247243737" alt="Sup+Dawg%3F" width="168" height="28"/></a>
Rich Media Ad Response
In addition to image and text creatives, we will also be providing Rich Media creative banners in the form of JavaScript and XHTML. As a result, you should not parse the Millennial Media response for an image or text banner, as there will be Rich Media creatives returned to your site. By parsing the Millennial Medial response, there is a much greater chance that the creative will be broken when delivered to the handset.
Additional examples of Rich Media creatives can be viewed at our demo site. If you view the source of these creatives, you will see an example of the response back to your sites.
XML
Unlike the HTML response type, you do not need a browser-like environment inside of your application. Instead, the XML response is meant to be parsed and displayed in your application any way you like. The key here is that the image has to be displayed and is able to be clicked. The syntax for the XML is below.
NOTE: This response type will NOT provide a Rich Media creative, as it requires JavaScript to run correctly. Therefore, you will only receive image, text, or combo ads with this response type.
<ad>
<bodyType/>
<clickUrl>
http://bank18.clicks.mp.mydas.mobi/handleClick.php5?apid=12849&
auid=123456789&uip=38.118.54.2&mmid=3972&osid=18&
urid=2ff0efd725c56db215c1c4f415663341&ri=18&acid=8246
</clickUrl>
<image>
<url>http://images.millennialmedia.com/225/8246.gif</url>
<mime_type>image/gif</mime_type>
<height>36</height>
<width>216</width>
<altText>Inspire-For the woman on the go</altText>
</image>
<text>Click here</text>
</ad>
In addition, here is the XSD schema for the XML response as well.
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="ad" type="adType" />
<xsd:complexType name="adType">
<xsd:sequence>
<xsd:element name="bodyType" type="xsd:string" />
<xsd:element name="clickUrl" type="xsd:string" />
<xsd:element name="image" type="imageType" />
<xsd:element name="text" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="imageType">
<xsd:sequence>
<xsd:element name="url" type="xsd:string" />
<xsd:element name="mime_type" type="xsd:string" />
<xsd:element name="height" type="xsd:int" />
<xsd:element name="width" type="xsd:int" />
<xsd:element name="altText" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
In order to receive this response, please contact us here and we can configure you in our system properly.
Application Coding
We have provided site coding to reside on the server that is communicating directly with the handset. As discussed above, we have coded certain sections to obtain the values discussed above. However, note that with regard to AUID and UA, there is additional work to done by the developer.
To view our ad server call in ASP click here
To view our ad server call in JSP5 click here
To view our ad server call in PERL click here
To view our ad server call in PHP click here
To view our ad server call in Ruby on Rails click here
To view our ad server call in VB.net click here