Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've written an article last year about using Google DFP with AdSense on infinite scroll pages which worked very well and was the basis for a number of my own sites and projects. In the past week however I noticed that GPT, which is the JavaScript library used to create DFP ad slots, started behaving erratically.
Update: Looks like Google have fixed this problem as of 22 March 2017.

The very first thing that was noticeably different was that whenever an ad slot was loaded, the web browser window would scroll down to that ad immediately. This behaviour wasn't there before the 20th of March (version 111) release.

The new behaviour of course broke any infinite scroll page, including my example on GitHub. Because the page was automatically scrolling to the ad slot, it would trigger the infinite scroll content loading event, which would load/create more content and another ad slot. Once that ad slot loaded, the page would scroll to it too, would trigger more content loading, and so on. The video below shows this in action.

If AdSense fallback is not used, there is no scroll to ad being triggered. The video below uses the same ads as Google's own infinite scroll example and there is no automatic scrolling, as it should be and was previously.

I've not figured out any workaround for this yet, if you do, let me know! I've also written a post on DFP help forum which hasn't got any answer so far.


A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.