How To Add Lazy Load Google Analytics in Blogger

How To Add Lazy Load Google Analytics in Blogger
How To Add Lazy Load Google Analytics in Blogger

Hello Everybody, How are you ? I think you (all) are fine. Finally I am going to post on How To Add Lazy Load Google Analytics in Blogger and How to Speed ​​up Blog Loading By Installing Lazyload Google Analytics in Blogger Website.

Google Analytics is the most widely used tool by bloggers to analyze or view the static of their blog visitors accurately. By using Google analytics on blogs, we can know the number of blog visitors, the area of ​​origin and even see the static behavior of visitors to the blog. Google Analytics is indeed believed to be the most accurate traffic tracking tool for now. 

But not infrequently from bloggers who complain about problems that are considered big by some of them, namely that the tracking code provided by Google analytics is very influential on loading their blogs and eventually the blog becomes slow.

Yes, indeed this Google analytics script can burden our blog loading. Just like the tracking meta tags provided by Google Analytics. But don't worry, there are still solutions to this kind of problem. The first way is to lighten the Google analytics script and the second is to install lazy load Google analytics script in Blogger Website.

Before the lazy load was installed, the score only got 85 - 89. And after installing lazy load, the score went up drastically. Do you also want to install this Google analytics lazy load on your blog so that the blog loads quickly? Check out the complete tutorial on how to install Google Analytics lazy load on the blog below.

How To Add Lazy Load Google Analytics in Blogger Website

Method 1 :-

Step 1 :- First of all you need Go To Blogger.Com. 
Step 2 :- Then Login to Your Blogger Account. 
Step 3 :- Then Click on Theme Menu. 
Step 4 :- After this Click on Edit Html. 
Step 5 :- Then find and replace the previous Google analytics script with the code below.

<script type='text/javascript'>
//<![CDATA[
var lazyanalisis=!1;window.addEventListener("scroll",function(){(0!=document.documentElement.scrollTop&&!1===lazyanalisis||0!=document.body.scrollTop&&!1===lazyanalisis)&&(!function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="//www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyanalisis=!0)},!0);
//]]>
</script>
Step 6 :-Then put the script below before the closing tag </body>

<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag(&#39;js&#39;, new Date());
  gtag(&#39;config&#39;, &#39;UA-XXXXXXXXX-X&#39;);
</script>

Don't forget to replace the text marked with your Analytics tracking ID

Step 6 :-If everything is done click on save.

Method 2 :-

Until this stage Google analytics lazy load has been installed on your blog. You can check the changes whether the speed score increases or remains the same. If it still remains and doesn't increase at all, you can try the second method below.

Step 1 :- First of all you need Go To Blogger.Com. 
Step 2 :- Then Login to Your Blogger Account. 
Step 3 :- Then Click on Theme Menu. 
Step 4 :- After this Click on Edit Html. 
Step 5 :-Delete and replace all your Google analytics code with the code below. Put the code below before the tag </body>

<script>
//<![CDATA[
var lazyanalisis=!1;window.addEventListener("scroll",function(){(0!=document.documentElement.scrollTop&&!1===lazyanalisis||0!=document.body.scrollTop&&!1===lazyanalisis)&&(!function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyanalisis=!0)},!0);
//]]>
</script>
<script>
  window.dataLayer=window.dataLayer||[];
  function gtag(){dataLayer.push(arguments);}
  gtag(&quot;js&quot;,new Date());
  gtag(&quot;config&quot;,&quot;UA-XXXXXXXXX-X&quot;);
</script>

Don't forget to replace the text marked with your Analytics tracking ID

Step 6 :-Then click save and re-check whether the loading of the blog and the speed score increases. It should have increased.

Conclusion

Well, that's the great tutorial on how to install Google analytics lazy load on a blog to speed up blog loading that I convey in this article. if you have face any error and problem you can ask in the comment section without any hesitate. Thanks For Reading This Post.

See Also :