V
V
Vechkov Alexander2019-11-20 20:20:14
Google Analytics
Vechkov Alexander, 2019-11-20 20:20:14

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>

Here are the results of google page speed without this code:
5dd5749fb8d10065677662.bin
And here is the result with the code:
5dd5750eb2e20418212871.bin
A year from Google Analytics does not affect the loading of a site from a computer, but on a mobile one ... you can see for yourself.
What is going on?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
bedolazhka, 2019-11-20
@Comrues

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; ?>

seen 100 out of 100? Now remove the crutch and stop doing stupid measurements, since Google did not consider it necessary to tell your measurer the caching time of his own analytics :)

N
Nikita Shinkevich, 2019-11-20
@domres

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 question

Ask a Question

731 491 924 answers to any question