Optimize Google Analytics / Google Tag Manager via Preconnect Headers

Add the following before the tag in your html to give google analytics loading a little boost and make the pagespeed and chrome auditing tool happy with your site

<link rel="dns-prefetch" href="https://www.google-analytics.com">
<link rel="dns-prefetch" href="https://www.googletagmanager.com">
<link href="https://www.google-analytics.com" rel="preconnect" crossorigin>
<link href="https://www.googletagmanager.com" rel="preconnect" crossorigin>

These optimizations can speed up your page load.
Opportunity: Preconnect to required origins
Consider adding preconnect or dns-prefetch resource hints to establish early connections to important third-party origins. Learn more.
https://www.google-analytics.com

Leave a Reply

Your email address will not be published. Required fields are marked *