Mobile app version of vmapp.org
Login or Join
Gloria169

: Can .htaccess be used to cache AdSense JavaScript to improve the pagespeed score? I'm AdSense publisher and I need to improve the page speed score for my site. It already gets 90/100 for speed

@Gloria169

Posted in: #Cache #GoogleAdsense #Htaccess #PageSpeed #Performance

I'm AdSense publisher and I need to improve the page speed score for my site. It already gets 90/100 for speed and 100/100 for User Experience, however Google AdSense code is preventing it from getting the full 100/100

This is the error:

Leverage browser caching for the following cacheable resources: pagead2.googlesyndication.com/pagead/js/adsbygoogle.js (60 minutes) pagead2.googlesyndication.com/pagead/osd.js (60 minutes)


My questions:


Can I cache adsbygoogle.js and osd.js for longer using .htaccess?
will it effect my AdSense revenue? I won't sacrifice my revenue for higher score.
How much longer should I cache it? 1 day? 1 week?


Google encourages me to improve my web page speed, but it seems like the only way to achieve 100/100 is to get rid of Google AdSense.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Gloria169

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

adsbygoogle.js and osd.js are third party JavaScript files. Your server isn't the one that sends them to users, so you have no control over their caching. .htaccess will be of no help in this situation.

The page speed recommendations are just that: recommendations. They are not hard and fast rules. There are times that you want to break the rules. In this case, AdSense doesn't allow those files to be cached because doing so might show the same ads to the same user. AdSense wants control over exactly which ads a user sees for each pageview.

So you are correct. If you want a perfect page speed score, you have to ditch AdSense.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme