Search code examples
adsmeasuregoogle-ad-manager

AdManager - how to measure viewability


I use Google AdManager and I have this problem. How to measure viewability for creatives, that are rendered out of its ad unit placeholders?

AdManager render all creatives in iframes. I use this script for manipulating with parent page:

var w=window.parent; //parent window reference
var d=w.document; //parent document reference
var jQuery = w.jQuery; //reference to jQuery in parent page context
var ifr = d.getElementById(window.frameElement.id);
ifr.style.display = 'none'; //hide iframe to avoid empty white place on the page
    
jQuery('...banner location...').after(...rendering creative out of adManager ad unit);

It works perfectly, but AdManager of course doesn't measure viewability of this creatives. Is there any way to solve this?

Move ad unit in DOM by script is not possible, because you cannot move active elements like iframes and scripts. Using adUnit as clickable layer and by "position: absolute" move it above rendered creative is not so easy, becouse different container (adUnit and real creative placeholder) with "position: relative" reset absolute coordinates. Therefore script musts calculate real position of both elements, but once is not enough. The page contains interactive elements and coordinates of elements may change over time.

Is there an easier way? Can I tell to AdManager somehow, that this element is part of creative and it can to count viewability when its in active viewport?

Thanks for you answers.


Solution

  • According to the official documentation (here), measuring viewability outside the ad iframe is not possible :

    Custom JavaScript executed as the creative payload that inserts the actual content somewhere else within the ad iframe, but outside of the creative . Active View will search for a second with the class attribute GoogleActiveViewInnerContainer. This expands to the size of the ad container, but allows the container size to be measured from within the ad iframe.

    If you find a way to render your creative within the ad iframe by forcing a new iframe size, you could wrap your rendered creative inside a div class="GoogleActiveViewInnerContainer" to tell Active View where to watch the viewability. Sadly and as detailed, it would only works within the ad iframe.