vastgoogle-ima

Empty vast tag occasionally


Why does vast tag occasionally comes empty? I am testing with examples from here: https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags#single-vpaid-2.0-linear

I can pick any vast link, for example:

https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dredirectlinear&correlator=

And when I open this in browser and occasionaly reload this url, I only get this in vast tag: (instead off full vast document)

<VAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vast.xsd" version="3.0"/>

What does this happen?


Solution

  • You need to make sure each request to the VAST tag contains a different correlator such as :

    https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&...&correlator=4345645667
    

    You can easily create a correlator random number generator as a variable :

    var randNum = Math.floor(Math.random() * (9999999 - 1 + 1)).toString();
    var vastUrl = "https://pubads...&correlator="+ randomCorrelator;
    

    See here for full documentation about the required parameters.