Google DFP dynamic ads refresh - is there a callback to find out if ads were loaded?

2.2k Views Asked by At

On our site we're triggering ads refresh after user clicks on "next button" between slides:

 googletag.pubads().refresh();

However if user clicks button real fast ads just keep reloading without never fully loading. So my question is - is there a way to determine when ads were fully loaded? as in: is there some sort of an event I can bind into that's being called when ads fully load? But so far I cannot find anything like that in DFP api.

2

There are 2 best solutions below

0
On

There is an unpublished internal method that you can hook on to that should allow you to detect when ads are loaded called renderEnded

I developed a jquery wrapper for DFP (https://github.com/coop182/jquery.dfp.js) that should help you solve this problem and there is an example on another question here: https://stackoverflow.com/a/18994892/1588845

Another plugin that could help you is this one that intercepts a few more different DFP events: https://github.com/mcountis/dfp-events

0
On

Google has now official support for this... the slotRenderEnded event: https://developers.google.com/doubleclick-gpt/reference#googletag.events.SlotRenderEndedEvent