WordPress.org

Ready to get started?Download WordPress

Forums

Ad Injection
[resolved] Infinite scroll on front page broken by ad injection (4 posts)

  1. robertliu
    Member
    Posted 1 year ago #

    I just installed Ad Injection and set up one ad to appear at the bottom of my content. I have Jetpack installed and have enabled Infinite Scroll.

    When I load my front page the single ad shows up at the bottom of my first blog post - great!

    But when I scroll down to the end of the page, the infinite scroll loads with the spinning circle thing. When the content is loaded, the entire webpage is replaced with just my "bottom ad" which appears at the top left corner.

    My current workaround is to disable in-content ads on my front page in which infinite scroll is enabled. It still displays fine on the individual pages/posts.

    http://wordpress.org/extend/plugins/ad-injection/

  2. reviewmylife
    Member
    Plugin Author

    Posted 1 year ago #

    Hi robertliu, what king of adverts are you using (e.g. AdSense)? Do the ads have any JavaScript that could interfere with the infinite scroll?

  3. robertliu
    Member
    Posted 1 year ago #

    Hi rml, I'm using Tradedoubler. This particular ad does use Javascript.

    And you're right, it's the ad that's interfering with infinite scroll, not Ad Injection - I just tested inserting the ad directly into an old blog post and I get the same problem when the infinite scroll loads that post. My apologies.

    Will try to investigate this myself but please let me know if you do have any ideas.

  4. robertliu
    Member
    Posted 1 year ago #

    My coding is a bit rusty but it seems Tradedoubler's javascript is only there to generate a random image url, for purposes of cache prevention and ensuring the image is always the latest.

    <script type="text/javascript">
    var uri = 'http://impgb.tradedoubler.com/imp?type(img)g(xxx)a(xxx)' + new String (Math.random()).substring (2, 11);
    document.write('<a href="http://clkuk.tradedoubler.com/click?p=xxx&a=xxx&g=xxx" target="_BLANK"><img src="'+uri+'" border=0></a>');
    </script>

    As I'm only experimenting with ad placement at the moment, I will just disable cache prevention (use static image url) which tradedoubler does allow.

    rml - great plugin btw!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic