Want to subscribe to topics you're interested in?
Become a Member

Nginx PageSpeed ngx_pagespeed advertising conflicts ?

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

  1. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
    When you create an ad, you can select Responsive :)
     
  2. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    ah i see it's buried half way down the list of ad units to select !

    will try now

    Just switched to async responsive smart sizing code
     
  3. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    yeah the responsive async adsense code https://support.google.com/adsense/answer/3213689 gives me 400 bad request error

    while trying async non-response with moved adsbygoogle.js works it still shows an error in console (but ads are reproted as served)

    Code:
    Error in event handler for (unknown): Blocked a frame with origin "http://googleads.g.doubleclick.net" from accessing a cross-origin frame.
    Stack trace: Error: Blocked a frame with origin "http://googleads.g.doubleclick.net" from accessing a cross-origin frame.
        at Error (native)
        at setupffoverrides (chrome-extension://hnjalnkldgigidggphhmacmimbdlafdo/onloadwff.js:151:86)
        at checkgenpwfillforms (chrome-extension://hnjalnkldgigidggphhmacmimbdlafdo/onloadwff.js:152:33)
        at receiveBG (chrome-extension://hnjalnkldgigidggphhmacmimbdlafdo/onloadwff.js:130:210)
        at Function.target.(anonymous function) (extensions::SafeBuiltins:19:14)
        at EventImpl.dispatchToListener (extensions::event_bindings:395:22)
        at Function.target.(anonymous function) (extensions::SafeBuiltins:19:14)
        at publicClass.(anonymous function) [as dispatchToListener] (extensions::utils:69:26)
        at EventImpl.dispatch_ (extensions::event_bindings:378:35)
        at EventImpl.dispatch (extensions::event_bindings:401:17) 
    looks more like a Chrome/Opera warning ?

    well Adsense do list async responsive as beta though heh

    maybe related to the technical considerations for responsive ad units ?

    I know the ad i have doesn't have a width set in parent container

     
    Last edited: Jun 4, 2014
  4. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Got async responsive working needed to specifically define width css3 elements

    Code:
    <style>
    .cmres1 { width: 320px; height: 50px; }
    @media(min-width: 500px) { .cmres1 { width: 468px; height: 60px; } }
    @media(min-width: 800px) { .cmres1 { width: 728px; height: 90px; } }
    </style>
    <!-- cmres1 -->
    <ins class="adsbygoogle cmres1"
         style="display:inline-block"
         data-ad-client="ca-pub-6669518204467592"
         data-ad-slot="2827005149"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    stripped out adsbygoogle.js and put that in PAGE_CONTAINER template

    HTML:
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    </head>
    Also added second responsive async add below content and working as well. Only time you sometimes see missing after first post responsive async ads is when you use jump to last post of a thread in forum thread list view because there's no way to load the first post view port of the window I guess if you jump to last post as opposed to coming in from top of the thread

    edit: even fixed the missing after post post ad missing too all you need to do is wrap Adsense code around a div tag with specified width element

    i.e.

    HTML:
    <div style="padding-top:10px;width:"85%";">
    <style>
    .cmres1 { width: 320px; height: 50px; }
    @media(min-width: 500px) { .cmres1 { width: 468px; height: 60px; } }
    @media(min-width: 800px) { .cmres1 { width: 728px; height: 90px; } }
    </style>
    <!-- cmres1 -->
    <ins class="adsbygoogle cmres1"
         style="display:inline-block"
         data-ad-client="ca-pub-6669518204467592"
         data-ad-slot="2827005149"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>
     
    Last edited: Jun 9, 2014
    • Like Like x 1
  5. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
    Did you already applied this fix to your site @BamaStangGuy ?
     
  6. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
    So you're using Advance code?
    Not the Smart Sizing? Responsive.
     
  7. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Yup Adsense Responsive Async Advanced Code + a extra DIV wrapper tag. Been working so far :D
     
    • Like Like x 1
  8. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
    I change my width to 100%, because with 85%, it's not centered.
    OK, I will enable ngx_pagespeed defer js and let see how it goes :)
     
  9. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    i used 85% for after post spot here seems to be okay for me heh
     
  10. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
    You need to check your code :)
    upload_2014-6-9_5-58-19.png
     
  11. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  12. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
    I have a problem now :( , to re-produce.
    1st - Please do this on another browser just for testing
    2nd - Clear all data/cache
    upload_2014-6-9_6-27-6.png
    3rd - Open my homepage: https://www.phcorner.net/
    On console view, you will notice this error which causing the ads don't load on first time visitor:
    upload_2014-6-9_6-30-17.png
    and related to pagespeed:
    upload_2014-6-9_6-32-48.png
     
  13. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
  14. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    don't want to clear my passwords and cookies heh

    does this happen on this forum when you clear all that data ?
     
  15. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
  16. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
    BTW, here's my config:
    Code:
    pagespeed on;
    
    # Custom for PHCorner.Net / fix for https only
    pagespeed LoadFromFile "http://www.phcorner.net" "/home/nginx/domains/phcorner.net/public";
    pagespeed LoadFromFile "https://www.phcorner.net" "/home/nginx/domains/phcorner.net/public";
    # End
    
    pagespeed Disallow "*/admin.php*";
    pagespeed Disallow "*/css.php*";
    pagespeed Disallow "*/mark-read*";
    pagespeed Disallow "*/forums/-/mark-read*";
    pagespeed Disallow "*/reply/preview*";
    pagespeed Disallow "*/account/alerts-popup*";
    pagespeed Disallow "*/conversations/popup*";
    pagespeed Disallow "*/conversations/*";
    pagespeed Disallow "*/account/alerts/*";
    pagespeed Disallow "*/?card*";
    pagespeed Disallow "*/misc/quick-navigation-menu*";
    pagespeed Disallow "*/misc/update-cache-ttl*";
    pagespeed Disallow "*/deferred.php*";
    pagespeed Disallow "*/attachments/*";
    pagespeed Disallow "*/rgba.php*";
    pagespeed Disallow "*/edit-inline*";
    pagespeed Disallow "*/save-inline*";
    pagespeed Disallow "*/posts/*/save-inline*";
    pagespeed Disallow "*/posts/*/edit*";
    pagespeed Disallow "*/posts/*/delete*";
    pagespeed Disallow "*/posts/*/ip*";
    pagespeed Disallow "*/posts/*/report*";
    pagespeed Disallow "*/proxy.php*";
    pagespeed Disallow "*/js/xenforo/xenforo.js*";
    
    # Custom for PHCorner.Net
    pagespeed Disallow "*/?&_xfRequestUri*";
    pagespeed Disallow "*/alerts-popup*";
    pagespeed Disallow "*/js/rellect/AdblockDetector/advertisement.js*";
    ###pagespeed Disallow "*/data/bdCache/css/*";
    pagespeed Disallow "*adsbygoogle*";
    pagespeed Disallow "*google_ad*";
    pagespeed Disallow "*show_ad*";
    pagespeed Disallow "*/adsbygoogle.js*";
    
    pagespeed MemcachedThreads 1;
    pagespeed MemcachedServers "localhost:11211";
    pagespeed MemcachedTimeoutUs 100000;
    
    pagespeed MaxCombinedCssBytes -1;
    pagespeed PreserveUrlRelativity on;
    pagespeed ImageResolutionLimitBytes 16777216;
    pagespeed AvoidRenamingIntrospectiveJavascript on;
    pagespeed ImageInlineMaxBytes 3072;
    pagespeed CssImageInlineMaxBytes 0;
    pagespeed MaxInlinedPreviewImagesIndex -1;
    pagespeed MinImageSizeLowResolutionBytes 3072;
    pagespeed MaxCombinedJsBytes 840000;
    ###pagespeed FetchHttps enable;
    
    ## ngx_pagespeed filters settings below ##
    
    pagespeed RewriteLevel CoreFilters;
    pagespeed EnableFilters collapse_whitespace,remove_comments;
    pagespeed EnableFilters move_css_above_scripts;
    pagespeed EnableFilters combine_css;
    pagespeed EnableFilters combine_javascript;
    pagespeed EnableFilters rewrite_css;
    pagespeed EnableFilters rewrite_javascript;
    pagespeed EnableFilters inline_javascript;
    pagespeed EnableFilters resize_mobile_images;
    pagespeed EnableFilters rewrite_images;
    pagespeed EnableFilters convert_png_to_jpeg;
    pagespeed EnableFilters convert_jpeg_to_webp;
    pagespeed EnableFilters convert_to_webp_lossless;
    pagespeed EnableFilters rewrite_css,sprite_images;
    pagespeed EnableFilters dedup_inlined_images;
    pagespeed EnableFilters elide_attributes;
    pagespeed EnableFilters lazyload_images;
    pagespeed LazyloadImagesAfterOnload off;
    pagespeed EnableFilters local_storage_cache;
    pagespeed EnableFilters insert_dns_prefetch;
    pagespeed EnableFilters remove_quotes;
    pagespeed EnableFilters trim_urls;
    pagespeed EnableFilters make_google_analytics_async;
    pagespeed EnableFilters inline_google_font_css;
    pagespeed EnableFilters inline_preview_images;
    pagespeed EnableFilters move_css_to_head;
    pagespeed EnableFilters prioritize_critical_css;
    pagespeed EnableFilters defer_javascript;
    
    ###pagespeed DisableFilters defer_javascript;
    
    ### END
     
  17. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    did you edit /usr/local/nginx/conf/pagespeedhandler.conf

    for the correction for ngx_pagespeed 1.8.31.3 beta

    from

    Code:
    location ~ "^/ngx_pagespeed_static/" { }
    to

    Code:
    location ~ "^/pagespeed_static/" { }
    then restart nginx
     
  18. rdan

    rdan Premium Member Premium Member

    4,194
    1,014
    113
    May 25, 2014
    Ratings:
    +1,438
    Local Time:
    3:12 AM
    Mainline
    10.2
  19. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    you seem to be using smartsizing class adsense code, try using the advanced code
     
  20. eva2000

    eva2000 Administrator Staff Member

    34,578
    7,648
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,763
    Local Time:
    5:12 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
..