Reputation: 219
I had gone through the documentation - https://support.google.com/dfp_premium/answer/2694377?hl=en
My requirement is that the DFP ads should only be refreshed when user is viewing THAT ad in browser window. If i had scroll OR that ad slot is not visible to user than dfp ad should not be refreshed.
Upvotes: 1
Views: 642
Reputation: 2338
You can subscribe to ImpressionViewableEvent. In the event handler call googletag.pubads().refresh([slot1]);
An alternate approach is to use the Waypoint library, which allows you to setup event handlers that view when an DOM element enters and leaves the window.
Upvotes: 2