How to cache or set expire of www.google-analytics.com/ga.js ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Hi,

The Google Pagespeed test always indicates to cache the javascript ga.js?
We are using the standard Nop Google Analytics plugin
Does someone know how this can be achieved?

Thanks
Pëter
7 years ago
You can't do anything with scripts hosted on third party domains.
If you really want to achieve better score. You can download this script and put it inside your server and use link to ga.js form your server.
You can check what Google says about that: https://support.google.com/analytics/answer/1032389?hl=en
7 years ago
Hi, Thanks for the reply.

The goal is not to cache the javascript on the server but to set the expire time on the client webbrowser.

Any idea where to add this?
7 years ago
I got your goal. But You should put this script on your server. And configure your server to set correct expire headers. http://stackoverflow.com/questions/10825497/iis-7-5-how-do-you-add-a-dynamic-http-expires-header

Anyway, server should tell for client about expiration date. And you have two variants:
1) Save this JS on your side and configur your server
2) Write and ask google to configure their server for expire headers

Of course, more realistic is first way.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.