Logging events with a Google Publisher Tag

according to the documentation at https://developers.google.com/doubleclick-gpt/reference#googletag.events.SlotRenderEndedEvent

There should be a way to register the event in which the tag was displayed:

Class googletag.events.SlotRenderEndedEvent

This event is fired when the slot on the page has finished rendering.

but when I inspected the dfp object, I don't see the event namespace

enter image description here

any idea how to register for this event?

+6
source share
1 answer

To register an 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 in the GPT link .

+19
source

Source: https://habr.com/ru/post/972354/


All Articles