I need to trigger some JavaScript after DFP has finished rendering all the ads on the page - or at least when it has triggered collapseEmptyDivs (which hides ad units that contain no line items).
Is anyone aware of a way to get DFP to trigger a callback after either of these events?
The GPT API now has a callback that is triggered after each slot is filled.
For example:
googletag.pubads().addEventListener('slotRenderEnded', function(event) { console.log('Creative with id: ' + event.creativeId + ' is rendered to slot of size: ' + event.size[0] + 'x' + event.size[1]); });
See https://developers.google.com/doubleclick-gpt/reference#googletag.events.SlotRenderEndedEvent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With