Answer the question
In order to leave comments, you need to log in
Why is google analytics slowing down the site?
When I insert the code from google analytics into my site, then google page speed drastically lowers my score.
HERE'S THE DATA:
The code I'm pasting:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxxx-x');
</script>
Answer the question
In order to leave comments, you need to log in
Hindus have been doing this since the time of the dinosaurs:
<?php if (!isset($_SERVER['HTTP_USER_AGENT']) || stripos($_SERVER['HTTP_USER_AGENT'], 'Сюда прописать имя юзерагента google page speed') === false): ?>
// сюда код аналитики
<?php endif; ?>
For many years I have already scored to optimize the site for these measurers and so on. Indeed, their own services create delays ... There were even attempts to steal these scripts for their hosting, but it turned out to be zero.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question