registering to events with google publisher tag

google-dfp

Solution

To register the event, use the following code:

<script type='text/javascript'>
  googletag.cmd.push(function() { 
    googletag.defineSlot('/123456/leadeboard', [[728, 90]], 'div-gpt-ad-123456789-0').addService(googletag.pubads());
    googletag.pubads().enableSingleRequest(); 
    googletag.pubads().addEventListener('slotRenderEnded', function(event) {
      console.log('Slot has been rendered:');
    });
    googletag.enableServices();
  });
</script>

The documentation is found in the GPT reference.

Problem

according to the documentation at https://developers.google.com/doubleclick-gpt/reference#googletag.events.SlotRenderEndedEvent there should be a way to register to an event that a tag was rendered: Class googletag.events.SlotRenderEndedEvent This event is fired when a slot on the page has finished rendering. but when i inspected the dfp object i don't see any event namespace any idea how to register to this event?

Original source