DFP post-rendering callback

后端 未结 6 1723
谎友^
谎友^ 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:22

    Check out the jQuery DFP extension I'm working on... it is still a bit of a work in progress but provides the callback you are after.

    An example of how to use it is in this file.

    You will see two callbacks are available... after each ad has loaded and after all ads have loaded. A class is also set on the ad unit container element, this can either be display-none (when no ad is found), display-block (when an ad is found) or display-original (for when no ad is found but the container div contained content to begin with, I use this for over riding certain parts of sites with ad content when required). These classes are of course useful to work with once inside the callback.

提交回复
热议问题