Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I host Google Analytics or Google Tag Manager scripts locally?

I would like to know if there is a way to implement google tag manager into my website without it giving me an error on Gtmetrix under Add expire header

(As seen below)

Add expire header google analytics

I was thinking if there is a way that you can insert the code in a file and somehow host it on the server itself.

Any suggestions would be appreciated.

Kind Regards, Faz

like image 288
Faziki Avatar asked Oct 28 '25 18:10

Faziki


1 Answers

The scripts you've highlighted are Google Analytics, not Google Tag Manager, but yeah, you could download them and host them yourself. Google advises against hosting GTM locally, because you won't automatically receive updates, but you could. There even is a WordPress plugin that helps you in hosting GA locally: Complete Analytics Optimization Suite (CAOS)

PS I'm in no way affiliated with the CAOS plugin, just found it on Google. Always test first and use at your own risk.

like image 69
Harm Avatar answered Oct 30 '25 09:10

Harm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!