Get the most out of your Centmin Mod LEMP stack
Become a Member

Nginx PageSpeed ngx_pagespeed advertising conflicts ?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by eva2000, Jun 2, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:29 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Last edited: Jun 9, 2014
  2. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    1:29 AM
    I am only using Google Adsense at the moment. I have found the same as @RoldanLT in that I will simply get blank ads during some page loads when deferring javascript. This is using pagespeed_no_defer in the script tag as well.
     
  3. rdan

    rdan Well-Known Member

    5,439
    1,399
    113
    May 25, 2014
    Ratings:
    +2,188
    Local Time:
    3:29 PM
    Mainline
    10.2
    Adsense ads content is very random so we cannot filter it 100%.
    I prefer disable defer js of pagespeed and just use the XenForo addon.
    No cut off with my revenue.
     
  4. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    1:29 AM
    Right now I have set my size limit on combining javascript to 840000 so that all javascript is combined together and I am only loading one javascript file inside <head> Good enough for me.
     
  5. rdan

    rdan Well-Known Member

    5,439
    1,399
    113
    May 25, 2014
    Ratings:
    +2,188
    Local Time:
    3:29 PM
    Mainline
    10.2
    How ? :)
     
  6. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    1:29 AM
    pagespeed MaxCombinedJsBytes 840000;
     
  7. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:29 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    You'd want to be careful with combining all js as such.. the large js file download time might override any benefit of combining js on slower connections.

    Was going to mention pagespeed_no_defer attribute https://developers.google.com/speed/pagespeed/module/filter-js-defer to exclude the javascript. Shame to see it not work for you Brent.
     
  8. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    1:29 AM
    It also breaks html 5 specifications when you use pagespeed_no_defer=""
     
  9. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:29 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    interesting problem as sort of defeats the purpose of pagespeed
     
  10. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    1:29 AM
    Here is why it breaks adsense:

    Screen Shot 2014-06-02 at 9.26.47 AM.png
     
  11. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:29 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  12. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    1:29 AM
    That is a separate issue from the adsense is it not? I have ran it with and without jquery excluded and still have seen the adsense issue. I just didn't add the jquery disallow back for the quick test this time.
     
  13. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:29 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    ah yes separate issue :)
     
  14. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    1:29 AM
    With your rules added back:

    Screen Shot 2014-06-02 at 9.33.51 AM.png

    Screen Shot 2014-06-02 at 9.34.44 AM.png
     
  15. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:29 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Okay for testing ngx_pagespeed with Google Adsense, I am testing serving 728x90 ads after the first post. It looks to be serving up fine here for me. What about you guys ?

    Code:
    [Tue, 03 Jun 2014 02:15:40 GMT] [Info] [6637] No permission to rewrite 'http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'
    pagespeed message log correctly ignores the Adsense code
     
  16. BamaStangGuy

    BamaStangGuy Active Member

    668
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    1:29 AM
    Are you using async responsive? It also seems to happen with three ads on a page. The last ad on the page is the one that does not load.
     
  17. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:29 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah using async - the default code adsense spits out for me to use
     
  18. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:29 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    might have found your problem as you got complaints console about adsbygoogle already having ads https://support.google.com/adsense/answer/3221666?hl=en

    so you can probably insert the adsbygoogle.js once in your header or footer templates and just include the rest for each instance ?

    I put the adsbygoogle.js in my PAGE_CONTAINER template

    HTML:
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    </head>
     
    Last edited: Jun 4, 2014
  19. rdan

    rdan Well-Known Member

    5,439
    1,399
    113
    May 25, 2014
    Ratings:
    +2,188
    Local Time:
    3:29 PM
    Mainline
    10.2
    default async and async responsive is different :)
     
  20. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:29 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    there's only 2 options available to me async or sync when i get my code though