DFP post-rendering callback

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

    If you need to identify the render end of a specific slot ( useful if you are using same creative for multiple slots ) you can do the following

    googleAd =  googletag.defineSlot('/xxxxx/web_top_AAAxAAA', [xxx, xxx], 'div-id').addService(googletag.pubads());    
    
    
    googletag.pubads().addEventListener('slotRenderEnded', function(event) {
                        if( event.slot.W == googleAd.W ){
                            // your code here
                        }
                    });
    

提交回复
热议问题