Mocean Ad Request API

From Mocean Mobile Wiki

Jump to: navigation, search

Contents

Overview

This document is intended to developers who would like to get instructions on how to access and integrate with the Mocean system from within Server-Side or Client-Side parts of Mobile Applications or Websites. The Mocean ad server is very flexible and can be accessed via a simple HTTP request. How the request to Mocean Ad Server should be formed, which parameters can be used for this and what you will get in the response you will find at the current page.

Ad Request

The Mocean Ad Server supports only GET HTTP Requests.

Base URL

The base URL of Mocean Ad Server API is http://ads.moceanads.com/ad

NOTE: You can also specify another white label domain in your request to override the default host (ads.moceanads.com). This can be configured via an email request to TechSupport.

HTTP Parameters Details

General Parameters

A basic ad request requires the following mandatory parameters. If you do not fill the required parameters in a correct way, Mocean Ad Server will not be able to respond back with an appropriate ad.

Parameter Req? Type Description Example
zone Yes Integer The id of the zone of the publisher site. 123
ip Yes String in dots-and-numbers format Client IP address. If present in the ad request, this parameter overrides the IP of the client making the request. Use this parameter if you are requesting ads on behalf of another client ip. 173.3.77.115
ua Yes String The browser user agent of the device making the request. Being passed directly, it redefines the value retrieved from ’User-Agent’ header field. SCH-R211+UP.Browser%2F6.2.3.8+%28GUI%29MMP%2F2.0

Optionally you may specify the following parameters in your ad request.

Parameter Req? Type Description Example
url No String The URL of the page which the ad is requested for. http://mydomain.com/sample_page/
count No Integer Number of ads to return in response to a request (from 1 to 5). Default value is 1. 2
test No Boolean Set to 1 to serve ads in a test mode. Please note that in a test mode only creative which refers to a test order can be served. Default value is 0. 1
timeout No Integer Timeout of ad call in milliseconds. This is the maximum time you are willing to wait for an ad response from the ad server. Default is 3000. If the response time exceeds the specified value, an empty response will be returned.2000
imageNo Boolean Used for getting an image directly. An ad impression is counted every time the "image=1" is sent irrespective of the pixel tracking is required for a line item or not.
NOTE: Creative should be an image to work. It is not to be used for a normal ad request and response.
1
over_18No Integer Filter ads by over 18 content: 0 or 1 — deny over 18 content, 2 — only over 18 content, 3 - allow all ads including over 18 content. Default value is 0.
NOTE: This parameter only works when the site of the requested zone has the Over Age 18 option enabled!
1
age *No Integer Age of a user. 24
birthday *No String Date of birthday in the following format YYYY-MM-DD. 1980-01-01
gender *No String User gender: “m” for male and “f” for female. m
ethnicity *No String User ethnicity.
Possible values: <empty>, black, white, eastindian, middleeastern, asian, latino, pacificislander, nativeamerican, mixed, other.
white
language *No String The ad language.
Possible values:<empty>, English, French, Spanish, Portuguese, Italian, Russian, German, Greek, Vietnamese, Chinese Traditional, Chinese Simplified, Czech, Arabic, Polish, Dutch, Lithuanian, Turkish, Serbian, Romanian, Chinese, Filipino, Belarusian, Croatian, Hungarian, Danish, Ukrainian, Parisian French, Albanian, Bulgarian, Zulu
English
keywordsNo String Comma-separated list of keywords to filter ads by.music,games
carrierNo String Wireless Carrier Name. A full list of carriers supported by Mocean Mobile can be viewed at the Mocean-Supported Carriers page.Verizon
ispNo String Internet Service ProviderAT&T
mncNo String Mobile Network Code. It is used in combination with a mobile country code (MCC) to uniquely identify a mobile phone operator/carrier 005
trackNo Boolean Track required. If "track=1" is sent, the ad server will automatically respond with 1x1 pixel url alongside the tag and will count an impression ONLY when this pixel is called.
NOTE: This parameter is not necessary to utilize pixel tracking. If pixel tracking is enabled on a line item, that line item will use pixel tracking without this parameter being passed in.
NOTE: In case a third party pixel is added to a line item (or from an ad feed) and pixel tracking is enabled on the line item, a compound tracking URL is added:
"track" : "http://ads.moceanads.com/1/img/52837ed0-b5ab-11e1-9498-005056967d1e?redir=http%3A%2F%2Fad.doubleclick.net%2Fad%2FN5763.157901.MOJIVA.COM%2FB5113120.5%3Bsz%3D
1x1%3Bord%3D1339628322%3F
".
1
no_external No Boolean Set to 1 to get any ad except an external ad feed.1
imgstyle No String A string value that will add a style attribute into <img> tag:
<img src="http://img.ads.moceanads.com/img/511/28a/1b46c13/image_320x50.jpg" border="0" style="text-align:center">
imgstyle=text-align:center
encoding No String Specifies a type of the ad response encoding (MIME charset). UTF-8 is used by default.encoding=UTF-32
target No String Changes the <a> target for HTML responses.target=_blank

* Can be used only for Parameters Translation when requesting external ads or if it is defined as a network custom parameter.

Ad Response Formats And Types

The ad server supports HTML, XML and JSON ad response formats. You can also specify a type of an ad to return. Here are the parameters that can be utilized for this purpose:

Parameter Req? Type Description Example
key No Integer Output format (1 - HTML, 3 - XML, 5 - JSON, 6 - JSONP, 8 - Generic JSON). By default 'key=1' is used. NOTE: 'key=5' and 'key=6' should be used together with 'callback' and 'jsvar' parameters.
NOTE: HTML format is not supported for native ads, whereas Generic JSON is supported only for native ads and not supported for other ad types.
1
type No Integer Type of ads to be returned (1 - text, 2 - image, 4 - richmedia ad, 8 - native ad). You can set different combinations with these values. For example, 3 = 1 + 2 (text + image), 7 = 1 + 2 + 4 (text + image + richmedia) and so on. Default value is ’-1’ that means any type of ads can be returned. NOTE: This parameter works only for direct line items, not for ad feeds! 7
adstype No Integer DEPRECATED. Type of ads (1 - text only, 2 - image only, 3 - image and text). Default value is 3. 3
jsvar * No String A name of a variable that will be assigned with the value of hash, returned when 'key=6'. abc
callback * No String A string value that will be integrated into the JSONP output if 'key=5'. MoceanAd

* NOTE: Please use one of 'callback' and 'jsvar' parameters along with 'key=6'. If both parameters are sent in the ad request, Mocean Ad Server will ignore 'jsvar' and will use only the 'callback' parameter.

The table bellow shows what combinations of 'key' and 'type' parameters can be used to retrieve a valid ad.

Ad type Key (ad format)
1 (HTML) 3 (XML) 5 (JSON) 6 (JSONP) 8 (Generic JSON)
1 (Text) + + + + -
2 (Banner) + + + + -
4 (RichMedia) + + + + -
8 (Native Ad) - + + + +

To get the most relevant ads from Mocean Ad Server, provide additional information related to the user and device using optional parameters described in the sections below.

User Identification Parameters

The table below represents which device ID parameters are supported by Mocean.

Parameter Req? Type Description Example
udid No String A custom unique identifier with MD5 hashing. -47b8ab68540f0e850cb5ad6a567d65b0a746eac9
androidaid No String Android ID for advertising. 38400000-8cf0-11bd-b23e-10b96e40000d
androidid No String Raw Android ID asdfgasdew423454
idfa No String Raw idfa (ID for Advertising) (iOS) 236A005B-700F-4889-B9CE-999EAB2B605D
idfv No String Raw idfv (ID for Vendor) (iOS) 599F9C00-92DC-4B5C-9464-7971F01F8370
macaddress No String Mac address (hex value, no dashes or semicolons). 001422012345
odin1 No String Raw Odin1 ID 82a53f1222f8781a5063a773231d4a7ee41bdd6f
secureudid No String DEPRECATED! Raw SecureUDID 54120315-DA42-49B4-9A8F-50647BB40654
openudid No String DEPRECATED! Raw OpenUDID Android: 34c3b496573e4ea2
iOS: 7e31be4f74eea5fab3d942494fc0e8156f53c6bf
wuid No String Windows Unique ID adgfasdgfaasdg...
waid No String Windows Advertising ID
adtruth No String AdTruth ID
bkid No String Bluekai ID
drawbridge No String Drawbridge ID

NOTE: Use “_md5” and “_sha1” suffixes to pass a MD5-hashed or a SHA1-hashed device ID parameter respectively. E.g. “macaddress_md5”, “macaddress_sha1”, etc.

Requesting Specific Ads

Mocean Mobile Platform allows for requesting specific ad(s) or ads of specific line item(-s) as well as requesting ads excluding some of them.

NOTE: To use this functionality, make sure the requested line item or the line item of the requested creative is adjusted appropriately. To make creatives available to be requested directly, the Direct Request option should be enabled for the corresponding line item.

Parameter Req? Type Description Example
creatives No Comma-separated integers Creative ID to return.
You may specify several creative IDs you would like to get separating them by commas. In this case the ad selection algorithm will be applied to the specified ads.
126545
123456,58795,2578
excreatives No Comma-separated integers Creative ID(s) to exclude from the selection.
If you would like to exclude some creatives from the processing, specify their IDs separated by commas.
126545
123456,58795,2578
lineitems No Comma-separated integers Line item ID which creatives you would like to get.
You may specify several line item IDs separated by commas.
321654
321654,125789
exlineitems No Comma-separated integers Line item ID(s) which creatives you wouldn't like to get in the response. 321654
321654,125789
order No Comma-separated integers Sorted list of line item IDs desired to be shown first. If ads of line items specified in the "order" parameter can not be served at the moment for any reason (e.g. limits exhausted, targeting is inactive, etc.), another available ad will be returned based on standard ad selection logic.321654,125789,34567

In case both creatives and lineitems parameters are sent in the request, the ad server will return a creative which ID is specified in the creatives parameters or which line item corresponds to the specified lineitems.

Geo Location Parameters

The Mocean platform allows advertisers to target line items against any location within a certain radius of a latitude and longitude. Publisher can specify the following parameters in the ad request to enable local-targeted advertising:

Parameter Req? Type Description Example
lat No Float User location latitude value (given in degrees). It’s used together with ’long’ parameter.40.71435
long No Float User location longitude value (given in degrees). It’s used together with ’lat’ parameter.-74.00597
country No String Country of visitor; it overrides country detected by IP. It is ISO 3166 to be used for specifying country code.US
mcc No Integer Mobile country code. It is used for determing the country of visitor. You can see the list of MCCs here. 311
region No String Region of visitor. ISO 3166-2 is used for United States and Canada and FIPS 10-4 is used for other countries.NY
city No String City of the device user (with state). For US only.New York, NY
area No Integer Area code of a user. For US only.212
dma No Integer DMA code of a user. For US only.734
zip No String Zip/Postal code of user. For US only.10013

NOTE: Lat/Long parameters explicitly passed in the ad request take precedence over those 'restored' from other geolocation parameters (ip, city, zip, etc.)

Publishers may set up the geolocation parameters in the site/app install code. Here is an example of the PHP install code:

<?php
   //...
   function moceanv2_ad()
   {
      //...
      $moceanv2_get .= '&city='.urlencode('New York, NY');
      //...
   }
?>

Geo Location Targeting Detection

Once the ad request is received, Mocean Ad Server processes it and retrieves parameters which can be used for detection the user location.

If no latitude and longitude values are passed, the user’s geolocation will be detected on the base of the IP address.

Line items with zip/dma/etc. targeting are served only if the specific parameter is passed in the ad request and matches it, or if the IP resolves this match.

Custom Ad Sizes in Install Codes

Mocean Mobile advertising network provides you a unique ability to set the size of ads shown on your site. For this purpose, use the parameters given below:

Parameter Req? Type Description Example
min_size_x No Integer Minimal width of the ad banner to be shown. 280
min_size_y No Integer Minimal height of the ad banner to be shown. 30
size_x No Integer Maximal width of the ad banner to be shown. 320
size_yNo Integer Maximal height the ad banner to be shown. 50
size_required No Boolean If set to 1, returns image size (width and height) in the ad response. 1
screen_resolutionNo Boolean Defines the option - physical (1) or logical (0) - for image size determination. If set to 1, the image size is determined according to the screen resolution height and width. If set to 0, maximum image height and width for this device are used.1

NOTE: To override sizing, you should supply both x and y parameters on the ad request. If you want to have a max size, you should send both size_x and size_y. If you want to have a min size, you should send min_size_x and min_size_y. Mocean doesn't require to send min and max values simultaneously.

Setting Ad Sizes

To enable your site to display ads of certain sizes, specify parameters mentioned above in your install code.

The example of setting size parameters in PHP install code is provided below:

<?php
   //...
   function moceanv2_ad()
   {
      //...
      $moceanv2_get .= '&size_x=320';
      $moceanv2_get .= '&size_y=50';
      $moceanv2_get .= '&min_size_x=280';
      $moceanv2_get .= '&min_size_y=30';
      //...
   }
?>

To get more install codes samples, please refer to the Install code samples page.

Usage Sample

http://ads.moceanads.com/ad?zone=18535&min_size_x=280&min_size_y=30&size_x=320&size_y=50&size_required=1&key=1&type=2

The ad server will return the biggest banner that can be shown on the user device meeting the following size requirements:

280 <= width <= 320 and 30 <= height <= 50

Formatting Parameters

You can further customize the look and feel of the ads returning from the platform directly via the ad request. Parameters available for this purpose are as follows:

Parameter Required Type Description Example
borderNo Boolean Show borders around banner ads: 0 — no border(default), 1 — show border. 1
textborderNo Boolean Show borders around text ads: 0 — no border (default), 1 — show border. 1
paramBGNo String Background color in HEX. #FFE6CC
paramBORDERNo String Border color for text ads in HEX. #FF3366
paramLINKNo String Determine the color of links in HEX.#FF00FF

NOTE: If these parameters are not specified in the request directly, the ad appearance on a site/app will be defined by parameters specified in the site install code.

Native Ads

To request a native ad, you should specify type=8 in the ad request.

NOTE: HTML response format is not supported for native ads, so do not use “type=8” together with “key=1”.

When requesting a native ad, you may also use the following native-related parameters.

Parameter Req? Type Description Example
native_content No Comma-separated integers List of asset elements of a native ad to return. Possible values:

0 (default) – any assets a native ad has;
1 – icon image;
2 – main image;
3 – title;
4 – description;
5 – call to action (not supported, will be ignored);
6 – rating;
7 – logo image. You can set different combinations with these values separating them by commas.

2,3,4
icon_size_x No Integer Width (exact) of the icon image for native ads. 15
icon_size_y No Integer Height (exact) of the icon image for native ads. 15
logo_size_x No Integer Width (exact) of the logo image for native ads. 50
logo_size_y No Integer Height (exact) of the logo image for native ads. 15
img_size_x No Integer Width (exact) of the main image for native ads. 320
img_size_y No Integer Height (exact) of the main image for native ads. 50
title_length No Integer Maximal length of the title for native ads. 20
description_length No Integer Maximal length of the description for native ads. 100
pubmatic_exfeeds No Integer ID(s) of the client network(s) as assigned by external partner to exclude from serving native ads (for external PubMatic Native ad feeds only). You can send some ID's separating them by commas. 1234

To get the detailed information on ad responses in different cases, please refer to the Mocean Ad Request API: Native Ads page.

Network Custom Parameters

Mocean Mobile advertising network allows its customers to add their own parameters and pass them in requests.

Once a custom parameter is added to the networks, it is saved to the database and can be used in line items targeting.

The example given below demonstrates the way how you can use custom parameters in the request.

Assume, a network owner creates a new custom parameter ‘age’ in the network with the following settings:

  • Name: age
  • Type: number
  • Number Range: min=16, max=100
  • Default value: none

If you want to get ads targeted by a certain age (e.g., 25), add ‘age=25’ to your request.

Sample of a request:

http://ads.moceanads.com/ad?zone=15562&ip=173.3.77.115&ua=Mozilla%2F5.0+%28Windows%3B+U%3B+Windows+NT+5.2%3B+ru%3B+rv%3A1.9.0.19%29+Gecko%2F2010031422+Firefox%2F3.0.19+%28.NET+CLR+3.5.30729%29&age=25

On this request you will get an ad which is targeted by age=25 or which have no age targeting at all.

Please note that when selecting an ad to return on the request, not only targeting parameters are taken into account, but also ad priorities and settings.

Below is an example of multiple values sent for a custom parameter:

http://ads.moceanads.com/ad?zone=15562&ip=173.3.77.115&ua=Mozilla%2F5.0+%28Windows%3B+U%3B+Windows+NT+5.2%3B+ru%3B+rv%3A1.9.0.19%29+Gecko%2F2010031422+Firefox%2F3.0.19+%28.NET+CLR+3.5.30729%29&age=25&age=40

An ad targeted against at least one of the specified values will be returned on the request. I.e., you will get an ad targeted by age=25, OR by age=40, OR an ad not having age targeting at all.

NOTE: If you send the same parameter multiple times, raw request logs and reporting will show multiple values being comma separated.

More detailed information about adding custom parameters can be obtained from the User Guide.

Ad Response

HTML

HTML response format (key=1) is available for text, image, rich media, external ads, but not available for native ads.

With respect to the ad type, ad response in the HTML format will have a structure as in examples given below.

Text

Example of a text ad response with two tracking pixels:

<a href="http://ads.moceanads.com/1/redir/2c060330-c120-11df-bff1-001ec9fd3a50/0/458976">Ad text here</a>
<img src="http://www.externalpage.com/imgpixel.gif" width="1" height="1" alt=""/>
<img src="http://www.another-externalpage.com/another-imgpixel.gif" width="1" height="1" alt=""/><br/>

Image

Example of an image ad response provided with a text:

<a href="http://ads.moceanads.com/1/redir/2c060330-c120-11df-bff1-001ec9fd3a50/0/458976">
   <img src="http://img.ads.moceanads.com/img/6j/84/kd/image_g35s9876982abba22baf83fbf1_320x50.jpg" border="0" alt=""/>
</a>
<img src="http://www.externalpage.com/imgpixel.gif" width="1" height="1" alt=""/>
<img src="http://www.another-externalpage.com/another-imgpixel.gif" width="1" height="1" alt=""/>
<br/>
<a href="http://ads.moceanads.com/1/redir/2c060330-c120-11df-bff1-001ec9fd3a50/0/458976">Ad text here</a>

Rich Media

Example of a rich media ad response with a single tracking pixel:

<iframe src="https://www.moceanmobile.net/images/logo.png" width="300" height="54" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe>
<img src="http://ads.moceanads.com/3/img/dc0544e1-9d43-11e4-9aff-a0369f1675fd" width="1" height="1" alt=""/>

External

There are two approaches for integrating with an external ad feed partner, Server-Side Integration and Client-Side Integration.

In case of Server-Side integration, Mocean ad server gets an ad from the Third Party Ad Server and then returns ad to the user in the requested format.

In case of Client-Side integration Mocean sends DATA which are used then for retrieving the ad from the third partner.

Server-Side Integration

Example of an external ad response provided with a tracking pixel. The ad in the example is an image obtained from the external Mocean-based ad feed network.

NOTE: When the ad response from the external ad feed network contains a pixel tracking URL and pixel tracking is required in Mocean, then the Mocean ad response will contain the third party's pixel URL wrapped into Mocean pixel tracking URL. When the ad feed's ad response contains more than one tracking pixel, only the 1st one will be wrapped, all the others will be passed as they come.

<a href="http://ads.moceanads.com/1/redir/d43ace20-9fb8-11e4-9915-a0369f16775d/0/675471">
   <img src="http://img.ads.mocean.mobi/img/b6/6c/69/image_549c7cec289b3ecda62dab0afd_320x50.png" />
</a><br/>
<a href="http://ads.moceanads.com/1/redir/d43ace20-9fb8-11e4-9915-a0369f16775d/1">TEST GRAPHIC AD</a>
<img src="http://ads.mocean.mobi/5/img/d43a8004-9fb8-11e4-94db-b8ca3a685e3a" width="1" height="1" />
<img src="http://ads.moceanads.com/1/img/d43ace20-9fb8-11e4-9915-a0369f16775d" width="1" height="1" alt=""/>

Client-Side Integration

In case of Client-Side integration Mocean ad response won't make a request to the Third Party ad server and will return only data for retrieving the ad from the third partner.

Parameters in the response depend on the external ad feed settings. An example given below contains parameters related to Millennial's ad feeds.

<!-- client_side_external_campaign
 <external_campaign version="1.0">
   <campaign_id>675489</campaign_id>
   <type>Millennial</type>
   <external_params>
      <param name="id">78y870b</param>
      <param name="adType">inline</param>
      <param name="zip">10036</param>
      <param name="long">-73.9902</param>
      <param name="lat">40.7593</param>
   </external_params>
   <track_url>http://ads.moceanads.com/8/img/00acce62-9fcb-11e4-8a24-bc305bf4914b</track_url>
 </external_campaign>
-->

XML

The ad response in the XML format (key=3) has the following structure:

  • Ad Element
Name Required Type Description
Attributes:
type Yes String Ad type: “text”, “image”, “richmedia” or “thirdparty”
feed No* String * Required for “thirdparty” ad type.
External ad feed partner which ad is served.
Elements:
url Yes String Click URL/Destination URL
text No* String * Required for “text” ad type.
Ad content.
img No* String * Required for “image” ad type.
Direct IMG URL of the ad. See Img Element.
track Yes* String DEPRECATED
* The element will be included into the response even though there is no tracking pixel.
Pixel tracking URL; corresponds to the first pixel tracking URL returned in the impressiontrackers element.
impressiontrackers[] Yes* Array of string elements * The element will be included into the response even though there is no tracking pixel.
Array of impression tracking URLs.
content No* String * Required for “richmedia” and “thirdparty” ad types.
Ad content.
response No* String * Required for “thirdparty” ad type.
Original ad response as returned from the third party ad server.
  • Img Element
Name Required Type Description
Attributes:
type No* String * Required for “image” ad type.
MIME image type:
• “image/<image_file_format>” (e.g. “image/jpeg”, “image/png” or “image/gif”);
• “application/unknown” - appears in case an externally hosted image is used.

NOTE: Ad response markup for native ads differs from other responses. Please refer to Mocean Ad Request API: Native Ads.


Subject to the ad type the ad response in the XML format will include different elements. Samples of ad requests for different ad types are given below.

Text

Sample of a text ad response:

<?xml version="1.0" encoding="UTF-8"?>
<mojiva>
   <ad type="text">
      <url><![CDATA[http://ads.moceanads.com/1/redir/2c060330-c120-11df-bff1-001ec9fd3a50/0/458976]]></url>
      <track><![CDATA[http://www.externalpage.com/imgpixel.gif]]></track>
      <text><![CDATA[Ad text here]]></text>
      <impressiontrackers>
         <impressiontracker><![CDATA[http://www.externalpage.com/imgpixel.gif]]></impressiontracker>
         <impressiontracker><![CDATA[http://www.another-externalpage.com/another-imgpixel.gif]]></impressiontracker>
      </impressiontrackers>
   </ad>
</mojiva>

Image

<?xml version="1.0" encoding="UTF-8"?>
<mojiva>
   <ad type="image">
      <url><![CDATA[http://ads.moceanads.com/1/redir/2c060330-c120-11df-bff1-001ec9fd3a50/0/458976]]></url>
      <text><![CDATA[Ad text here]]></text>
      <img type="image/jpeg"><![CDATA[http://img.ads.moceanads.com/img/6j/84/kd/image_g35s9876982abba22baf83fbf1_320x50.jpg]]></img>
      <track><![CDATA[http://www.externalpage.com/imgpixel.gif]]></track>
      <impressiontrackers>
         <impressiontracker><![CDATA[http://www.externalpage.com/imgpixel.gif]]></impressiontracker>
         <impressiontracker><![CDATA[http://www.another-externalpage.com/another-imgpixel.gif]]></impressiontracker>
      </impressiontrackers>
   </ad>
</mojiva>

Rich Media

<?xml version="1.0" encoding="UTF-8"?>
<mojiva>
   <ad type="richmedia">
      <url><![CDATA[http://ads.moceanads.com/0/redir/cadeb9e1-9fc7-11e4-905f-a0369f1675cd/0/675238]]></url>
      <track><![CDATA[http://ads.moceanads.com/0/img/cadeb9e1-9fc7-11e4-905f-a0369f1675cd]]></track>
      <impressiontrackers>
         <impressiontracker><![CDATA[http://ads.moceanads.com/0/img/cadeb9e1-9fc7-11e4-905f-a0369f1675cd]]></impressiontracker>
      </impressiontrackers>
      <content>&lt;iframe src="https://www.moceanmobile.net/images/logo.png" width="300" height="54" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;</content>
   </ad>
</mojiva>

Native

<?xml version="1.0" encoding="UTF-8"?>
<mojiva>
   <ad type="native">
      <creativeid>5</creativeid>
      <link>
      	 <url><![CDATA[http://ads.moceanads.com/2/redir/16dfdad0-5e88-11e4-b2b0-005056967d1f/0/5]]></url>
      </link>		
      <assets>
         <asset id="2" type="img" width="358" height="228">
            <subtype>3</subtype>
            <url><![CDATA[http://img.ads.moceanads.com/native/96/d6/50/image_8f7587855c466d9a7388e219aa_358x228.png]]></url>
            <link>
               <url><![CDATA[http://ads.moceanads.com/2/redir/16dfdad0-5e88-11e4-b2b0-005056967d1f/1/5]]></url>
            </link>
         </asset>
         <asset id="3" type="title">
            <text><![CDATA[Native Ad Title]]></text>
         </asset>
         <asset id="4" type="data">
            <subtype>2</subtype>
            <value><![CDATA[Native Ad Description]]></value>
         </asset>
         <asset id="6" type="data">
            <subtype>3</subtype>
            <value><![CDATA[4]]></value>
         </asset>
      </assets>
      <impressiontrackers>
         <impressiontracker>
            <![CDATA[http://ads.moceanads.com/2/img/16dfdad0-5e88-11e4-b2b0-005056967d1f]]>
         </impressiontracker>
      </impressiontrackers>
   </ad>
</mojiva>

Ad response markup details for native ads you can find at Mocean Ad Request API: Native Ads.

External

Server-Side Integration

<?xml version="1.0" encoding="UTF-8"?>
<mojiva>
   <ad type="thirdparty" feed="Sample Mocean Network">
      <url><![CDATA[http://ads.moceanads.com/2/redir/2b0a3df0-9fc6-11e4-8a0e-bc305bf8de23/0/675471]]></url>
      <text><![CDATA[TEST GRAPHIC AD]]></text>
      <img><![CDATA[http://img.ads.mocean.mobi/img/b6/6c/69/image_549c7cec289b3ecda62dab0afd_320x50.png]]></img>
      <track><![CDATA[http://ads.moceanads.com/2/img/2b0a3df0-9fc6-11e4-8a0e-bc305bf8de23?redir=http%3A%2F%2Fads.mocean.mobi%2F9%2Fimg%2F2b0a6501-9fc6-11e4-8d31-bc305bf4abcf]]></track>
      <content>&lt;a href="http://ads.moceanads.com/2/redir/2b0a3df0-9fc6-11e4-8a0e-bc305bf8de23/0/675471"&gt;&lt;img src="http://img.ads.mocean.mobi/img/b6/6c/69/image_549c7cec289b3ecda62dab0afd_320x50.png" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;a href="http://ads.moceanads.com/2/redir/2b0a3df0-9fc6-11e4-8a0e-bc305bf8de23/1"&gt;TEST GRAPHIC AD&lt;/a&gt;&lt;img src="http://ads.mocean.mobi/9/img/2b0a6501-9fc6-11e4-8d31-bc305bf4abcf" width="1" height="1" /&gt;&lt;img src="http://ads.moceanads.com/2/img/2b0a3df0-9fc6-11e4-8a0e-bc305bf8de23" width="1" height="1" alt=""/&gt;</content>
      <response>&lt;a href="http://ads.mocean.mobi/9/redir/2b0a6501-9fc6-11e4-8d31-bc305bf4abcf/0/675469"&gt;&lt;img src="http://img.ads.mocean.mobi/img/b6/6c/69/image_549c7cec289b3ecda62dab0afd_320x50.png" /&gt;&lt;/a&gt;&lt;br/&gt;&lt;a href="http://ads.mocean.mobi/9/redir/2b0a6501-9fc6-11e4-8d31-bc305bf4abcf/0/675469"&gt;TEST GRAPHIC AD&lt;/a&gt;&lt;img src="http://ads.mocean.mobi/9/img/2b0a6501-9fc6-11e4-8d31-bc305bf4abcf" width="1" height="1" /&gt;</response>
      <impressiontrackers>
         <impressiontracker><![CDATA[http://ads.moceanads.com/2/img/2b0a3df0-9fc6-11e4-8a0e-bc305bf8de23?redir=http%3A%2F%2Fads.mocean.mobi%2F9%2Fimg%2F2b0a6501-9fc6-11e4-8d31-bc305bf4abcf]]></impressiontracker>
      </impressiontrackers>
   </ad>
</mojiva>

Client-Side Integration

<?xml version="1.0" encoding="UTF-8"?>
<mojiva>
   <ad type="thirdparty" feed="Millennial (Client Side SDK Required)">
      <url />
      <text />
      <track><![CDATA[http://ads.moceanads.com/5/img/78933473-9fce-11e4-94db-b8ca3a685e3a]]></track>
      <content>&lt;!-- client_side_external_campaign
&lt;external_campaign version="1.0"&gt;&lt;campaign_id&gt;675489&lt;/campaign_id&gt;&lt;type&gt;Millennial&lt;/type&gt;&lt;external_params&gt;&lt;param name="id"&gt;78y870b&lt;/param&gt;&lt;param name="adType"&gt;&lt;/param&gt;&lt;param name="zip"&gt;10036&lt;/param&gt;&lt;param name="long"&gt;-73.9902&lt;/param&gt;&lt;param name="lat"&gt;40.7593&lt;/param&gt;&lt;/external_params&gt;&lt;track_url&gt;http://ads.moceanads.com/5/img/78933473-9fce-11e4-94db-b8ca3a685e3a&lt;/track_url&gt;&lt;/external_campaign&gt;
--&gt;</content>
      <response>&lt;!-- client_side_external_campaign
&lt;external_campaign version="1.0"&gt;&lt;campaign_id&gt;675489&lt;/campaign_id&gt;&lt;type&gt;Millennial&lt;/type&gt;&lt;external_params&gt;&lt;param name="id"&gt;78y870b&lt;/param&gt;&lt;param name="adType"&gt;&lt;/param&gt;&lt;param name="zip"&gt;10036&lt;/param&gt;&lt;param name="long"&gt;-73.9902&lt;/param&gt;&lt;param name="lat"&gt;40.7593&lt;/param&gt;&lt;/external_params&gt;&lt;track_url&gt;%TRACKURL%&lt;/track_url&gt;&lt;/external_campaign&gt;
--&gt;</response>
      <impressiontrackers>
         <impressiontracker><![CDATA[http://ads.moceanads.com/5/img/78933473-9fce-11e4-94db-b8ca3a685e3a]]></impressiontracker>
      </impressiontrackers>
   </ad>
</mojiva>

JavaScript Responses

The ad response in the Javascript format (key=5 or key=6) includes the following elements:

  • Ad Element
Name Required Type Description
url Yes String Click URL/Destination URL
text No* String * Required for “text” ad type.
Ad text.
img No* String * Required for “image” ad type.
Direct IMG URL of the ad.
type No* String * Required for “image” ad type.
MIME image type:
• “image/<image_file_format>” (e.g. “image/jpeg”, “image/png” or “image/gif”);
• “application/unknown” - appears in case an externally hosted image is used.
track Yes* String DEPRECATED
* The element will be included into the response even though there is no tracking pixel.
Pixel tracking URL; corresponds to the first pixel tracking URL returned in the impressiontrackers element.
impressiontrackers[] Yes* Array of string elements * The element will be included into the response even though there is no tracking pixel.
Array of impression tracking URLs.
content No* String * Required for “richmedia” and “thirdparty” ad types.
Ad content.
response No* String * Required for “thirdparty” ad type.
Original ad response as returned from the third party ad server.

NOTE: Ad response markup for native ads differs from other responses. Please refer to Mocean Ad Request API: Native Ads.


Javascript

To get a Javascript response, specify 'key=6' and 'jsvar=VARIABLE_NAME' in your ad request.

Sample ad request:

http://ads.moceanads.com/ad?zone=15562&ip=173.3.77.115&ua=Mozilla%2F5.0+%28Windows%3B+U%3B+Windows+NT+5.2%3B+ru%3B+rv%3A1.9.0.19%29+Gecko%2F2010031422+Firefox%2F3.0.19+%28.NET+CLR+3.5.30729%29&key=6&jsvar=abc&type=3

With respect to the ad type, you will get one of the following responses.

Text

var abc = [{
   "url": "http://ads.moceanads.com/1/redir/76ef4301-85a4-11e4-8781-bc305bf4914b/0/472655",
   "text": "Text ad",
   "track": "http://ads.moceanads.com/1/img/995c6970-eb22-11df-8f56-001d096a03fe",
   "impressiontrackers": ["http:\/\/ads.moceanads.com\/1\/img\/995c6970-eb22-11df-8f56-001d096a03fe", "http:\/\/go.vrvm.com\/t?m=2799745&net=41&sum=1028&i=4587&d=487212&z=58487411"]
}];

Image

var abc = [{
   "url": "http://ads.moceanads.com/1/redir/49343b70-85a7-11e4-a11e-a0369f1675fd/0/492914",
   "img": "http://img.ads.moceanads.com/img/j5/42/dk/image_d8367fjf74jd730fnd47aldhf7_400x250.jpg",
   "type": "image/jpeg",
   "track": "http://ads.moceanads.com/1/img/d6206004-c121-11df-bff1-001ec9fd3a50",
   "impressiontrackers": ["http:\/\/ads.moceanads.com\/1\/img\/d6206004-c121-11df-bff1-001ec9fd3a50", "http:\/\/go.vrvm.com\/t?m=9358786943&net=385&sum=54&i=459346&d=5587&z=12154"]
}];

Rich Media

var abc = [{
   "url": "http://ads.moceanads.com/5/redir/f8961b21-9fc8-11e4-94db-b8ca3a685e3a/0/675238",
   "track": "http://ads.moceanads.com/5/img/f8961b21-9fc8-11e4-94db-b8ca3a685e3a",
   "impressiontrackers": ["http://ads.moceanads.com/5/img/f8961b21-9fc8-11e4-94db-b8ca3a685e3a"],
   "content": "<iframe src=\"https:\/\/www.moceanmobile.net\/images\/logo.png\" width=\"300\" height=\"54\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\"><\/iframe>"
}];

Native

var abc = [{
   "type":"native",
   "creativeid":5,
   "link":{
      "url":"http:\/\/ads.moceanads.com\/2\/redir\/9091aab0-5e8e-11e4-b2b0-005056967d1f\/0\/5"
   },
   "assets":[
      {
         "id":2,
         "type":"img",
         "entity":{
            "subtype":3,
            "url":"http:\/\/img.ads.moceanads.com\/native\/96\/d6\/50\/image_8f7587855c466d9a7388e219aa_358x228.png",
            "w":358,
            "h":228
         },
         "link":{
            "url":"http:\/\/ads.moceanads.com\/2\/redir\/9091aab0-5e8e-11e4-b2b0-005056967d1f\/1\/5"
         }
      },
      {
         "id":3,
         "type":"title",
         "entity":{
            "text":"Native Ad Title"
         }
      },
      {
         "id":4,
         "type":"data",
         "entity":{
            "subtype":2,
            "value":"Native Ad Description"
         }
      },
      {
         "id":6,
         "type":"data",
         "entity":{
            "subtype":3,
            "value":"4"
         }
      }
   ],
   "impressiontrackers":[
      "http:\/\/ads.moceanads.com\/2\/img\/9091aab0-5e8e-11e4-b2b0-005056967d1f"
   ]
}];

External

Server-Side Integration
var abc = [{
   "url": "http://ads.moceanads.com/12/redir/96ca2a50-9fc6-11e4-a693-d4ae529dff27/0/675471",
   "text": "TEST GRAPHIC AD",
   "img": "http:\/\/img.ads.mocean.mobi\/img\/b6\/6c\/69\/image_549c7cec289b3ecda62dab0afd_320x50.png",
   "track": "http://ads.moceanads.com/12/img/96ca2a50-9fc6-11e4-a693-d4ae529dff27?redir=http%3A%2F%2Fads.mocean.mobi%2F5%2Fimg%2F96cac692-9fc6-11e4-94db-b8ca3a685e3a",
   "content": "<a href=\"http:\/\/ads.moceanads.com\/12\/redir\/96ca2a50-9fc6-11e4-a693-d4ae529dff27\/0\/675471\"><img src=\"http:\/\/img.ads.mocean.mobi\/img\/b6\/6c\/69\/image_549c7cec289b3ecda62dab0afd_320x50.png\" \/><\/a><br\/><a href=\"http:\/\/ads.moceanads.com\/12\/redir\/96ca2a50-9fc6-11e4-a693-d4ae529dff27\/1\">TEST GRAPHIC AD<\/a><img src=\"http:\/\/ads.mocean.mobi\/5\/img\/96cac692-9fc6-11e4-94db-b8ca3a685e3a\" width=\"1\" height=\"1\" \/><img src=\"http:\/\/ads.moceanads.com\/12\/img\/96ca2a50-9fc6-11e4-a693-d4ae529dff27\" width=\"1\" height=\"1\" alt=\"\"\/>",
   "response": "<a href=\"http:\/\/ads.mocean.mobi\/5\/redir\/96cac692-9fc6-11e4-94db-b8ca3a685e3a\/0\/675469\"><img src=\"http:\/\/img.ads.mocean.mobi\/img\/b6\/6c\/69\/image_549c7cec289b3ecda62dab0afd_320x50.png\" \/><\/a><br\/><a href=\"http:\/\/ads.mocean.mobi\/5\/redir\/96cac692-9fc6-11e4-94db-b8ca3a685e3a\/0\/675469\">TEST GRAPHIC AD<\/a><img src=\"http:\/\/ads.mocean.mobi\/5\/img\/96cac692-9fc6-11e4-94db-b8ca3a685e3a\" width=\"1\" height=\"1\" \/>",
   "impressiontrackers": ["http:\/\/ads.moceanads.com\/12\/img\/96ca2a50-9fc6-11e4-a693-d4ae529dff27?redir=http%3A%2F%2Fads.mocean.mobi%2F5%2Fimg%2F96cac692-9fc6-11e4-94db-b8ca3a685e3a"]
}];
Client-Side Integration
var abc = [{
   "url": "",
   "text": "",
   "track": "http://ads.moceanads.com/9/img/9901cd01-9fd5-11e4-8d31-bc305bf4abcf",
   "content": "<!-- client_side_external_campaign\n<external_campaign version=\"1.0\"><campaign_id>675489<\/campaign_id><type>Millennial<\/type><external_params><param name=\"id\">78y870b<\/param><param name=\"adType\">inline<\/param><param name=\"zip\">10036<\/param><param name=\"long\">-73.9902<\/param><param name=\"lat\">40.7593<\/param><\/external_params><track_url>http:\/\/ads.moceanads.com\/9\/img\/9901cd01-9fd5-11e4-8d31-bc305bf4abcf<\/track_url><\/external_campaign>\n-->",
   "response": "<!-- client_side_external_campaign\n<external_campaign version=\"1.0\"><campaign_id>675489<\/campaign_id><type>Millennial<\/type><external_params><param name=\"id\">78y870b<\/param><param name=\"adType\">inline<\/param><param name=\"zip\">10036<\/param><param name=\"long\">-73.9902<\/param><param name=\"lat\">40.7593<\/param><\/external_params><track_url>http://ads.moceanads.com/9/img/9901cd01-9fd5-11e4-8d31-bc305bf4abcf<\/track_url><\/external_campaign>\n-->",
   "impressiontrackers": ["http:\/\/ads.moceanads.com\/9\/img\/9901cd01-9fd5-11e4-8d31-bc305bf4abcf"]
}];

JSONP

To get a JSONP response specify 'key=5' or 'key=6' together with 'callback' parameter in your ad request.

Sample ad request with 'key=5':

http://ads.moceanads.com/ad?zone=15562&ip=173.3.77.115&ua=Mozilla%2F5.0+%28Windows%3B+U%3B+Windows+NT+5.2%3B+ru%3B+rv%3A1.9.0.19%29+Gecko%2F2010031422+Firefox%2F3.0.19+%28.NET+CLR+3.5.30729%29&key=5&callback=MoceanAd

On this request you will get one of the following responses.

Text

MoceanAd([  
   {  
      "url":"http://ads.moceanads.com/1/redir/76ef4301-85a4-11e4-8781-bc305bf4914b/0/472655",
      "text":"Text ad",
      "track":"http://ads.moceanads.com/1/img/995c6970-eb22-11df-8f56-001d096a03fe",
      "impressiontrackers":[  
         "http:\/\/ads.moceanads.com\/1\/img\/995c6970-eb22-11df-8f56-001d096a03fe",
         "http:\/\/go.vrvm.com\/t?m=2799745&net=41&sum=1028&i=4587&d=487212&z=58487411"
      ]
   }
]);

Image

MoceanAd([  
   {  
      "url":"http://ads.moceanads.com/1/redir/49343b70-85a7-11e4-a11e-a0369f1675fd/0/492914",
      "img":[  
         "http://img.ads.moceanads.com/img/j5/42/dk/image_d8367fjf74jd730fnd47aldhf7_400x250.jpg"
      ],
      "track":[  
         "http://ads.moceanads.com/1/img/d6206004-c121-11df-bff1-001ec9fd3a50"
      ],
      "impressiontrackers":[  
         "http:\/\/ads.moceanads.com\/1\/img\/d6206004-c121-11df-bff1-001ec9fd3a50",
         "http:\/\/go.vrvm.com\/t?m=9358786943&net=385&sum=54&i=459346&d=5587&z=12154"
      ]
   }
]);

Rich Media

MoceanAd([  
   {  
      "url":"http://ads.moceanads.com/2/redir/82f9c4c0-9fc8-11e4-8a0e-bc305bf8de23/0/675238",
      "track":"http://ads.moceanads.com/2/img/82f9c4c0-9fc8-11e4-8a0e-bc305bf8de23",
      "impressiontrackers":[  
         "http://ads.moceanads.com/2/img/82f9c4c0-9fc8-11e4-8a0e-bc305bf8de23"
      ],
      "content":"<iframe src=\"https:\/\/www.moceanmobile.net\/images\/logo.png\" width=\"300\" height=\"54\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\"><\/iframe>"
   }
]);

Native

MoceanAd([  
   {  
      "type":"native",
      "creativeid":5,
      "link":{  
         "url":"http:\/\/ads.moceanads.com\/2\/redir\/9091aab0-5e8e-11e4-b2b0-005056967d1f\/0\/5"
      },
      "assets":[  
         {  
            "id":2,
            "type":"img",
            "entity":{  
               "subtype":3,
               "url":"http:\/\/img.ads.moceanads.com\/native\/96\/d6\/50\/image_8f7587855c466d9a7388e219aa_358x228.png",
               "w":358,
               "h":228
            },
            "link":{  
               "url":"http:\/\/ads.moceanads.com\/2\/redir\/9091aab0-5e8e-11e4-b2b0-005056967d1f\/1\/5"
            }
         },
         {  
            "id":3,
            "type":"title",
            "entity":{  
               "text":"Native Ad Title"
            }
         },
         {  
            "id":4,
            "type":"data",
            "entity":{  
               "subtype":2,
               "value":"Native Ad Description"
            }
         },
         {  
            "id":6,
            "type":"data",
            "entity":{  
               "subtype":3,
               "value":"4"
            }
         }
      ],
      "impressiontrackers":[  
         "http:\/\/ads.moceanads.com\/2\/img\/9091aab0-5e8e-11e4-b2b0-005056967d1f"
      ]
   }
]);

External

Server-Side Integration
MoceanAd([  
   {  
      "url":"http://ads.moceanads.com/9/redir/04a30ba1-9fc7-11e4-8d31-bc305bf4abcf/0/675471",
      "text":"TEST GRAPHIC AD",
      "img":[  
         "http:\/\/img.ads.mocean.mobi\/img\/b6\/6c\/69\/image_549c7cec289b3ecda62dab0afd_320x50.png"
      ],
      "track":[  
         "http://ads.moceanads.com/9/img/04a30ba1-9fc7-11e4-8d31-bc305bf4abcf?redir=http%3A%2F%2Fads.mocean.mobi%2F9%2Fimg%2F04a359c2-9fc7-11e4-8d31-bc305bf4abcf"
      ],
      "content":"<a href=\"http:\/\/ads.moceanads.com\/9\/redir\/04a30ba1-9fc7-11e4-8d31-bc305bf4abcf\/0\/675471\"><img src=\"http:\/\/img.ads.mocean.mobi\/img\/b6\/6c\/69\/image_549c7cec289b3ecda62dab0afd_320x50.png\" \/><\/a><br\/><a href=\"http:\/\/ads.moceanads.com\/9\/redir\/04a30ba1-9fc7-11e4-8d31-bc305bf4abcf\/1\">TEST GRAPHIC AD<\/a><img src=\"http:\/\/ads.mocean.mobi\/9\/img\/04a359c2-9fc7-11e4-8d31-bc305bf4abcf\" width=\"1\" height=\"1\" \/><img src=\"http:\/\/ads.moceanads.com\/9\/img\/04a30ba1-9fc7-11e4-8d31-bc305bf4abcf\" width=\"1\" height=\"1\" alt=\"\"\/>",
      "response":"<a href=\"http:\/\/ads.mocean.mobi\/9\/redir\/04a359c2-9fc7-11e4-8d31-bc305bf4abcf\/0\/675469\"><img src=\"http:\/\/img.ads.mocean.mobi\/img\/b6\/6c\/69\/image_549c7cec289b3ecda62dab0afd_320x50.png\" \/><\/a><br\/><a href=\"http:\/\/ads.mocean.mobi\/9\/redir\/04a359c2-9fc7-11e4-8d31-bc305bf4abcf\/0\/675469\">TEST GRAPHIC AD<\/a><img src=\"http:\/\/ads.mocean.mobi\/9\/img\/04a359c2-9fc7-11e4-8d31-bc305bf4abcf\" width=\"1\" height=\"1\" \/>",
      "impressiontrackers":[  
         "http:\/\/ads.moceanads.com\/9\/img\/04a30ba1-9fc7-11e4-8d31-bc305bf4abcf?redir=http%3A%2F%2Fads.mocean.mobi%2F9%2Fimg%2F04a359c2-9fc7-11e4-8d31-bc305bf4abcf"
      ]
   }
]);
Client-Side Integration
MoceanAd([  
   {  
      "url":"",
      "text":"",
      "track":"http://ads.moceanads.com/5/img/4163e140-9fd6-11e4-94db-b8ca3a685e3a",
      "content":"<!-- client_side_external_campaign\n<external_campaign version=\"1.0\"><campaign_id>675489<\/campaign_id><type>Millennial<\/type><external_params><param name=\"id\">78y870b<\/param><param name=\"adType\">inline<\/param><param name=\"zip\">10036<\/param><param name=\"long\">-73.9902<\/param><param name=\"lat\">40.7593<\/param><\/external_params><track_url>http:\/\/ads.moceanads.com\/5\/img\/4163e140-9fd6-11e4-94db-b8ca3a685e3a<\/track_url><\/external_campaign>\n-->",
      "response":"<!-- client_side_external_campaign\n<external_campaign version=\"1.0\"><campaign_id>675489<\/campaign_id><type>Millennial<\/type><external_params><param name=\"id\">78y870b<\/param><param name=\"adType\">inline<\/param><param name=\"zip\">10036<\/param><param name=\"long\">-73.9902<\/param><param name=\"lat\">40.7593<\/param><\/external_params><track_url>http://ads.moceanads.com/5/img/4163e140-9fd6-11e4-94db-b8ca3a685e3a<\/track_url><\/external_campaign>\n-->",
      "impressiontrackers":[  
         "http:\/\/ads.moceanads.com\/5\/img\/4163e140-9fd6-11e4-94db-b8ca3a685e3a"
      ]
   }
]);

Generic JSON

Generic JSON ('key=8') is supported only for native creatives. Here the response of a direct native ad is provided as an example. Please refer to [[Mocean Ad Request API: Native Ads] to get more examples of native ad responses.

{  
   "ads":[  
      {  
         "type":"native",
         "creativeid":5,
         "link":{  
            "url":"http:\/\/ads.moceanads.com\/2\/redir\/9091aab0-5e8e-11e4-b2b0-005056967d1f\/0\/5"
         },
         "assets":[  
            {  
               "id":2,
               "type":"img",
               "entity":{  
                  "subtype":3,
                  "url":"http:\/\/img.ads.moceanads.com\/native\/96\/d6\/50\/image_8f7587855c466d9a7388e219aa_358x228.png",
                  "w":358,
                  "h":228
               },
               "link":{  
                  "url":"http:\/\/ads.moceanads.com\/2\/redir\/9091aab0-5e8e-11e4-b2b0-005056967d1f\/1\/5"
               }
            },
            {  
               "id":3,
               "type":"title",
               "entity":{  
                  "text":"Native Ad Title"
               }
            },
            {  
               "id":4,
               "type":"data",
               "entity":{  
                  "subtype":2,
                  "value":"Native Ad Description"
               }
            },
            {  
               "id":6,
               "type":"data",
               "entity":{  
                  "subtype":3,
                  "value":"4"
               }
            }
         ],
         "impressiontrackers":[  
            "http:\/\/ads.moceanads.com\/2\/img\/9091aab0-5e8e-11e4-b2b0-005056967d1f"
         ]
      }
   ]
}

Ad response markup details for native ads you can find at Mocean Ad Request API: Native Ads.

Failure Responses

If an error occurred, an error message will be returned on the ad request. An error can occur for any of the following reasons.

No ads available

No ads found on the request.

HTML Failure Response
For HTML format the empty answer will be returned.
Header named as "X-Ad-Network-Status" with text "1 No Matching Ad" will be returned.
XML Failure Response
<?xml version="1.0" encoding="UTF-8"?>
<mojiva>
   <error code='404'>No ads available</error>
</mojiva>
JavaScript Failure Responses
  1. For 'key=5' (JSON) and 'callback=MoceanAd' parameters the response will look like:
    MoceanAd([<CONTENT>]);
  2. For 'key=6' (JSONP) and 'jsvar=VARIABLE_NAME' parameters:
    var VARIABLE_NAME = [<CONTENT>];
  3. For 'key=8' (Generic JSON) the response will be:
    <CONTENT>

Where <CONTENT> is of the following structure:

{"error" : "No ads available"}

Invalid parameters

Error code for this reason is -1. The following reasons can lead to this error,

  • Zone has not been passed in or (if passed) doesn't not exist
  • Zone requested (or a site the zone is belong to) has been deleted
  • Zone requested is in site that hasn't been approved yet
  • Zone specified in the request is in network that is inactive at the moment
  • IP is incorrect
HTML Failure Response
<!-- invalid params -->
XML Failure Response
<?xml version="1.0" encoding="UTF-8"?>
<mojiva>
   <error code='-1'>Error has occurred</error>
</mojiva>
JavaScript Failure Responses
  1. For 'key=5' (JSON) and 'callback=MoceanAd' parameters the response will look like:
    MoceanAd([<CONTENT>]);
  2. For 'key=6' (JSONP) and 'jsvar=VARIABLE_NAME' parameters:
    var VARIABLE_NAME = [<CONTENT>];
  3. For 'key=8' (Generic JSON) the response will be:
    <CONTENT>

Where <CONTENT> is of the following structure:

{"error" : "-1"}

Request Timeout

The server timed out while retrieving the ad (error code is 408).

HTML Failure Response
<!-- Error: 408 -->
XML Failure Response
<?xml version="1.0" encoding="UTF-8"?>
<mojiva>
   <error code='408'>Error has occurred</error>
</mojiva>
JavaScript Failure Responses
  1. For 'key=5' (JSON) and 'callback=MoceanAd' parameters the response will look like:
    MoceanAd([<CONTENT>]);
  2. For 'key=6' (JSONP) and 'jsvar=VARIABLE_NAME' parameters:
    var VARIABLE_NAME = [<CONTENT>];
  3. For 'key=8' (Generic JSON) the response will be:
    <CONTENT>

Where <CONTENT> is of the following structure:

{"error" : "408"}


Personal tools