In
Part I, Chris showed you how to create and traffic a video ad. In Part II, you’ll learn how to get that ad displayed before your video content in Flash, HTML5, iOS, or Android.
The
IMA SDK requires you to have an ad tag that points to your ad. An
ad tag is a URL that returns a
VAST response. The VAST (or VMAP) response contains information about your ad, including tracking URLs, clickthrough destinations, and the media files for the video ad. For more information about VAST, see the
IAB website.
If you’re using DFP, the UI can generate an ad tag for you based on your line item and ad unit criteria. To generate the ad tag for your line item, follow
these steps.
Now that you have your ad tag, let’s take a look at some of the parameters. We’ll use one of our standard sample tags for this exercise:
http://pubads.g.doubleclick.net/gampad/ads?
sz=640x360&
iu=/6062/iab_vast_samples/skippable&
ciu_szs=300x250,728x90&
impl=s&
env=vp&
gdfp_req=1&
output=xml_vast2&
unviewed_position_start=1&
url=[referrer_url]&
correlator=[timestamp]&
scor=[timestamp]
sz
The size of the video ad that you’re requesting.
iu
Your “inventory unit” - the ad unit you created in Part I. This is in the format <network_code>/<ad_unit_code path>.
ciu_szs
If your ad unit has associated companion ads, their sizes will be listed here.
impl
The request mode. Here, “s” for “sync”.
env
The environment. Here, “vp” for “video player”.
gdfp_req
Indicates that this is a DFP request rather than the legacy Google Ads Manager.
output
The type of output you want from your ad request. Typical values are “vast” or “vmap”.
unviewed_position_start
Enables delayed impressions for your ad. This ensures that an impression isn’t counted until the ad starts playing.
url
The URL of the page requesting ads. This will also be automatically filled in by the SDK.
correlator
This randomly-generated value will be filled in by the SDK. It’s used for a number of things, but they all boil down to detecting ad requests that come from the same instance of a page load.
scor
Like the correlator, but refreshed when your video stream changes rather than when the page refreshes. Used to detect ad requests that come from the same video stream instance.
For more info on these parameters, see
this DFP help center article.
Now that you have a basic understanding of your ad tag, it’s time to plug it into your IMA SDK implementation. If you’d like to use a video player with the SDK pre-integrated, we have pre-baked solutions for
HTML5,
iOS, and
Android. If you want to do your own SDK integration, check out the quick start guide for
Flash,
HTML5,
iOS, or
Android. In each of the sample implementations, you’ll find a reference to at least one ad tag.
For example, the HTML5 ad tag reference is in ads.js and looks like this:
adsRequest.adTagUrl = “YOUR_AD_TAG_HERE”;
Now fire up the sample and request an ad. Voila! You’ll now see the ad you trafficked in Part I serving as a pre-roll to your video content!
As always, if you have any questions feel free to contact us via the
support forum.