Geeks With Blogs
expression{web.blog} Thoughts on Expression Web and web tools in general

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

Posted on Wednesday, March 30, 2016 6:59 AM | Back to top


Comments on this post: Caching Google Analytics code to improve PageSpeed

# re: Caching Google Analytics code to improve PageSpeed
Requesting Gravatar...
As a ball park I think my 18 lab VM training environment will cost in the region of $80 per day on our EA.
192.168.l.l
Left by ronment on Jul 28, 2016 8:56 PM

# re: Caching Google Analytics code to improve PageSpeed
Requesting Gravatar...
1 Software mxf converter free download to convert HD camcorder files. convert avchd video files to avi,
mp4, wmv, mov mts to avi mp4 mov mkv iMovie mts converter e re
Left by googl on Dec 10, 2016 3:25 PM

# re: Caching Google Analytics code to improve PageSpeed
Requesting Gravatar...
Ver good caching plugin. NIce tips.
what mobile Price with specs.
Left by Azhar Munir on Jul 06, 2017 5:12 AM

# re: Caching Google Analytics code to improve PageSpeed
Requesting Gravatar...
very NIce tips for my site
تيوب ميت
Left by برامج الاندرويد تحميل on Jul 17, 2017 3:46 AM

Your comment:
 (will show your gravatar)


Copyright © ihaynes | Powered by: GeeksWithBlogs.net