How To Overcome Browser Leverage Caching From Google Analytics Script

Read too:

Leverage Caching

This time I want to update again on how to cope with browser caching leverage (take advantage of browser cache storage) from Google Analytics script.
Who are the bloggers you know about Google Analytics? All is definitely in the know ...

With features that I think "sophisticated", which is able to see the visitors in our blog in real-time, making it almost all sites on the internet using it, including me too.

In addition, the traffic data displayed is also very, very accurate. I once proved it myself on a blog that is still 0 traffic. I see its real-time data, an active visitor there is 1 (yes I myself). Then, I try to open the blog via mobile phone. After a few seconds, active visitor directly increased to 2 (me on the laptop and phone).

Well, the topic of the problem is, for people perfectionist (like me this), the blog always wants to perform the best among others, one of them in the field of speed. The use of Google Analytics can cause the score in PageSpeed Insights to decrease, so my blog scores no more 100 ...

Honestly, when it only reduced only 1 percent, so 99% ...

After going here, I finally get the solution, that is by using the script Google Analytics Light version by Jesse Luoto. Immediately we refer to the discussion ya ...

How To Overcome Browser Leverage Caching From Google Analytics Script

First, first save your old Google Analytics script in Notepad, then delete the one in Edit HTML. Usually more or less the form of code like this:

<! - Global site tags (gtag.js) - Google Analytics -> 
<script async src = "https://www.googletagmanager.com/gtag/js?id=UA-115195123-1"> </ script > 
<script> 
  window.dataLayer = window.dataLayer || []; 
  function gtag () {dataLayer.push (arguments);} 
  gtag ('js', new Date ()); 
  gtag ('config', ' UA-XXXXX '); 
</ script>

Save the code I marked yellow above. The code is your tracking ID in Google Analytics.

Then, still in Edit HTML, find the code </ body>, and enter the following code right above it:

<script async = "async" src = "https://cdn.jsdelivr.net/ga-lite/latest/ga-lite.min.js" /> 
<script> 
var galite = galite || {}; 
galite.UA = ' UA-XXXXX '; 
</ script>

Replace the code I'm marking yellow with the Analytics tracking ID you've saved earlier.

Then save the template and see the results. Please check on PageSpeed Insights, does the score remain ugly or better than ever? And do not forget to check in Analytics too, is it an error or ordinary?

Hopefully, the article about how to cope with Google Analytics browser caching leverage with the Light script above can be useful for my friend ... 

If this article is felt interesting and useful, please share it by pressing the button below :)

Share this

Related Posts

Previous
Next Post »

1 komentar:

Write komentar
May 19, 2018 delete

I like async make blogger fast loading

Reply
avatar

Insert your comment below...