If you use Google Analytics on a site and use Google PageSpeed to optimise performance, one of the odd things you find is that Google’s own analytics code gets flagged under the ‘Leverage browser caching’ header.
This appears to be an insurmountable problem but in fact there are scripts that poll GA on a regular basis and inject the latest version in your pages.
The simplest one I’ve yet found is Jehna’s “ga-lite”, described as a small cacheable subset of the Google GA client.
It could be easier to use, simply add the following code to the end of your <body>
<script src="https://cdn.jsdelivr.net/ga-lite/latest/ga-lite.min.js" async></script>
<script>
var galite = galite || {};
galite.UA = 'UA-XXXXXX'; // Insert your tracking code here
</script>
Full details on GitHub at https://github.com/jehna/ga-lite