DFP post-rendering callback

后端 未结 6 1735
谎友^
谎友^ 2021-01-31 04:04

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

6条回答
  •  爱一瞬间的悲伤
    2021-01-31 04:27

    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

提交回复
热议问题