Expires Headers + google-analytics.com/ga.js

I get %89 score on my page http://www.ghlsports.com/, in the Expires Headers section with this comment

There is 1 static component without a far-future expiration date.


Is their a method to fix this, I found this article


Is this a good idea / bad idea any other recommendations

Don’t do it. Google Analytics is used across so much of the web that it is almost guaranteed to be in a user’s cache even with a short expires.

If you want to get a perfect score, than put it on your server and have it cached for as long as you want.

Create a cron job to always download the latest version from google :slight_smile:

Like Patrick said,
Don’t do it.

Our website get %84 score on my page http://www.pajasaapartments.com/ in google page speed and showing following error

http://www.google-analytics.com/ga.js missing expiry time

Suggest how to remove same .

Don’t worry about it, it’s not in your control. As long as you are using the async analytics snippet you are fine. Optimize of the actual performance, not necessarily the scores.

i checked my website www.ace-services.uk in Gtmetrix and shows Add Expires headers https://www.google-analytics.com/analytics.js Grade C and need to optimise , shall i leave that as it is ?

Same problem for my website https://www.banglabook.org/ , thought score is PageSpeed Score
(99%) ,YSlow Score(92%) .

Easy fix. Use CAOS plugin https://wordpress.org/plugins/host-analyticsjs-local/

CAOS for Google Analytics allows you to host analytics.js locally and keep it updated using WordPress’ built-in Cron-schedule. Fully automatic!