WordPress.org

Forums

Autoptimize
[resolved] Can i enable Javascript caching when i use Google adsense? (16 posts)

  1. liton1980
    Member
    Posted 1 year ago #

    Can i place Google adsense ads on my site and cache Javascript using Autoptimize plugin without facing any problem for showing ads? Or i should exclude Google adsense from caching?

    http://wordpress.org/plugins/autoptimize/

  2. Frank Goossens
    Member
    Plugin Author

    Posted 1 year ago #

    Autoptimize already excludes some of adsense's code (show_ads.js, google_ad, document.write), so I'd start of excluding nothing and see where that leads you. If need be, you can exclude more either in the admin interface as you did for visual composser or, e.g. when putting the adsense code in a widget, by wrapping it in between nopitimize-tags (cfr. the faq).

  3. liton1980
    Member
    Posted 1 year ago #

    OK, thanks a lot for your good support.

  4. Frank Goossens
    Member
    Plugin Author

    Posted 1 year ago #

    Cfr. your question in the frontier-theme forum;

    I don't know AdSense that well, but the standard adsense-scripts are excluded by default, meaning you don't have to do a thing. You might have to do some tweaking if you use adsense-placeholders (in html-comments) or if you use other wordpress plugins that do AdSense for you.

  5. liton1980
    Member
    Posted 1 year ago #

    OK, i place a sample adsense here:

    <script type="text/javascript">
    google_ad_client = "pub-";
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = "728x90_as";
    google_ad_type = "text_image";
    google_color_border = "FFFFFF";
    google_color_bg = "0000FF";
    google_color_link = "FFFFFF";
    google_color_text = "000000";
    google_color_url = "008000";
    </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

    Should u exclude show_ads.js?

  6. Frank Goossens
    Member
    Plugin Author

    Posted 1 year ago #

    no, this should work as is (cfr. code in http://plugins.svn.wordpress.org/autoptimize/tags/1.6.6/classes/autoptimizeScripts.php, "google_ad" string will match for the first script-block and "show_ads.js" for the 2nd script block).

  7. liton1980
    Member
    Posted 1 year ago #

    So its not needed that i exclude anything for running Google adsense?

  8. Frank Goossens
    Member
    Plugin Author

    Posted 1 year ago #

    If all you have is the above block of code; correct, nothing to exclude.

    But pray do test dear Sir! ;-)

  9. liton1980
    Member
    Posted 1 year ago #

    OK, thanks again for your excellent support.

  10. xpiramide
    Member
    Posted 1 year ago #

    hello,
    Can i ask something here please.
    When i load my site asyncr, i dont see the adsense on my site.
    What can i do?
    tnx

  11. Frank Goossens
    Member
    Plugin Author

    Posted 1 year ago #

    difficult to say based on that info xpiramide;

    * what do you mean by "I load my site asyncr"?
    * how do you load adsense?

  12. xpiramide
    Member
    Posted 1 year ago #

    hey hello,
    Before i was chance my website i load adsense Sync
    and now i make the site async en take the async adsense too.
    When i take the Sync adsense, than you see the adsense.
    Thnx for your answer.

  13. Frank Goossens
    Member
    Plugin Author

    Posted 1 year ago #

    well, if the async code you use is the one shown on https://support.google.com/adsense/answer/3221666?hl=en, then you should exclude "adsbygoogle" and maybe explicitely "adsbygoogle.js" as well.

    hope this helps,
    frank

  14. xpiramide
    Member
    Posted 1 year ago #

    Hey futtta,
    Thanks for your answer.
    I dont know or i can fix it.
    I gone look of i can fix that buth ??
    So mutxh thanks again and see you later.
    Paul

  15. slamjam
    Member
    Posted 1 year ago #

    Sorry to pick up this again.

    I just installed autoptimize on my blog, and it's the first minimize plugin that's not messing up my layout. That's great. Thx for this work.

    Regarding adsense i think you have to exclude the following:
    //pagead2.googlesyndication.com/pagead/js/adsbygoogle.js

    I am not a pro. But in google adsense guidelines it's written that you are not allowed to change the adsense code.

    If i don't exlude the line above, my adsense is working but the code is changed (lines ar missing etc). And i think you can get problems with google because of that.

  16. slamjam
    Member
    Posted 1 year ago #

    Udpate:

    Maybe i should say that i am using adrotate to dysplay my ads.

    And i found a better solution. In adrotate you can just put this one before ads <!--noptimize--> and this one after ads <!--/noptimize-->

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Autoptimize
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.