3 ms·
The suggestion says to cache the js file for the analytics tracker, not to remove it.
by wldcordeiro 11y ago
The suggestion says to cache the js file for the analytics tracker, not to remove it.
- Fuffidish 11y agoGood luck setting caching headers on an external resource.
- latch 11y agoAre you being funny? If not, how do you suggest they do that?
- ZeroGravitas 11y agoIt's hosted by Google, so they control the cache time.
- eli 11y agoYou actually can host the Google Analytics JS file locally, though I'm not sure it's an officially supported configuration.
- danieltillett 11y agoDo you have any resources on doing this?
- codedokode 11y agoYou could probably proxy a file through your own server and add any headers you like. But in that case browser cannot use a version of a script cached at other sites.
- rgbrenner 11y agoit's definitely not a supported config: https://support.google.com/analytics/answer/1032389?hl=en https://support.google.com/analytics/answer/1032389?hl=en But you can download it, and host it locally. Just update it periodically. As you can see from the changelog, it only changes every few months: https://developers.google.com/analytics/devguides/collection/analyticsjs/changelog?csw=1 https://developers.google.com/analytics/devguides/collection... Google actually takes a few days to deploy updates to all of their servers. So a daily script to update it on your server would be fine.
- danieltillett 11y agoThanks for this.
- StavrosK 11y agoWhy do they only cache it for two hours? Do they want changes to be that quick to take?