Integration‎ > ‎

Mobile Web tags

Vdopia allows rich-midea and video ad units to be placed on mobile web pages through simple Javascript tags.
The API is designed for loading Vdopia ads directly using javascript or to load html via a proxy sitting on your servers.
This API is available on Vdopia servers at the location:
http://serve.vdopia.com/adserver/html5/inwapads

Parameters

Targeting Parameters

We pick up best available ad format based on inout adFormat and allowed ad formats in the portal. Here is the document which explains this.

Cache-busting

All tags received from Vdopia include a cache-busting parameter. e.g.

<script src='http://serve.vdopia.com/adserver/html5/inwapads/?adFormat=preappvideo;ak=AX123;version=1.0;cb=[timestamp]'></script>
The macro '[timestamp]' should be replaced with the correct macro for the ad-server into which this tag is being placed to ensure proper cache-busting. Please refer to your ad-server documentation for the correct macro - examples of cache-busting macros are '%n', '[RAND]'

Examples

NOTE: Examples are best viewed on Android/iOS devices. The pages also work on HTML5 friendly browsers like Safari and Chrome.

PreRoll video ad

This format can be used for showing pre-roll video advertisements on html video content in mobile browsers. Some/all video links on the page where the tag is placed become trigger links, and a video ad is launched when a link is clicked. When the video ad completes (or is skipped), options to interact with the ad appear on screen (e.g. share on facebook, watch full trailer etc.). When the user closes the ad experiences or ad completes playing, actual video content gets loaded in the native player and starts playing.

Tag used in example:
<script src='http://serve.vdopia.com/adserver/html5/inwapads/?adFormat=inappvideo&fullscreen=1&attr=rel&val=preroll&ak=AX123&version=1.0'></script>

InWap video ad
Some/all links on the page where the tag is placed become trigger links, and a video ad is launched when a link is clicked. When the video ad completes (or is skipped), options to interact with the ad appear on screen (e.g. share on facebook, watch full trailer etc.). When the user closes the ad experiences the next page loads (going to the link initially clicked by the user)

All links on this page are ad triggers.


Tag used in example:
<script src='http://serve.vdopia.com/adserver/html5/inwapads/?adFormat=inappvideo&attr=href&val=*&ak=AX123&version=1.0'></script>

This tag specifies that all anchor tags with hrefs leading to any URL (wild-card) should be trigger links.

Form actions

Form submit actions also can trigger the inapp video ads. On this page submit action trigger the ads to play.


Tag used in example:
<script src='http://serve.vdopia.com/adserver/html5/inwapads/?adFormat=inappvideo&element=input&attr=value&val=Search&ak=AX123&version=1.0'></script>

This tag specifies that all the input element nodes with attribute name value set to value Search  should be trigger links.

PreWap video ad

A video ad autoplays when the page is loaded. When the video ad completes (or is skipped), options to interact with the ad appear on screen (e.g. share on facebook, watch full trailer etc.).

without banner

http://i2.vdopia.com/dev/test/wap/vid.html

Tag used in example:
<script src='http://serve.vdopia.com/adserver/html5/inwapads/?adFormat=preappvideo&ak=AX123&version=1.0'></script>

with banner

http://i2.vdopia.com/dev/test/wap/vidbanner.html

Tag used in example:
<script src='http://serve.vdopia.com/adserver/html5/inwapads/?adFormat=preappvideo&serveBanner=1&ak=AX123&version=1.0'></script>

Banner ad

Tag pulls an image banner where it is placed. Default image size is 320x48.

Tag used in example:
<script src='http://serve.vdopia.com/adserver/html5/inwapads/?adFormat=banner&ak=AX123&version=1.0'></script>

Javascript Ad events

Detecting unavailable ads

If no ads are available then the JS returned by the call to fetch an ad throws an event that can be processed by the application. The event is called 'ivdoAdsUnavailable'.
Example of processing 'no ads' event:
window.addEventListener("ivdoAdsUnavailable", function(){alert("NO ADS AVAIALBALE");});

This event can be used, for example, to make a call to a remnant ad server to fetch an alternate ad.

Detecting Ad play

event - ivdoAdLoaded
triggered for - VDO and interstitial ads (as well as miniVDO)

Detecting Ad end

event - ivdoAdsClosed
triggered for - VDO and interstitial ads

Manually cleaning up Vdopia Player

If publisher wants to cleanup the vdopia player (as sometimes audio doesn't stop if you update the page using ajax) then it can be achieved by adding following javascript into your page before vdopia's tag.
function cleanupVdopiaPlayer(){
  if (typeof vdoplayer != 'undefined'){
    vdoplayer.cleanup();
  }
}
Now call to cleanupVdopiaPlayer will cleanup the player whenever it is required.

Using third party tag in case of unavailable ads

There are two ways of doing so. First is using ivdoAdsUnavailable event. This method only works when third part tag does not use document.write method. Most of the tags (including google adsense) uses document.write. In that case you can employ following tag.
<script type='text/javascript'>
var alt_tag='<script type="text/javascript">google_ad_client="ca-pub-XXXXXXXXX";google_ad_slot="XXXXXXX";google_ad_width=320;google_ad_height=50;</sc'+'ript><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></scr'+'ipt>';
</script>
<script type='text/javascript' src='http://serve.vdopia.com/adserver/html5/inwapads/?adFormat=AD_FORMAT;ak=API_KEY;version=1.0;alttag=alt_tag'>
Here alt_tag is alternate tag (in this example adsense tag) which should be escaped in a proper manner ie </script> should be splited so that it doesn't cause any javascript errors. Now you can pass this variable name (alt_tag) in vdopia's tag parameters via alttag parameter.


Comments