Dell
Dell

Reputation: 219

How to reload DFP ads ONLY when that ad is IN VIEW of browser window

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

Answers (1)

BeWarned
BeWarned

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

Related Questions