How to Lazyload Google analytics javascript code in Blogger

Friends, We all know speed of a website is the first impression about the increase user. It's important to understand that you won't get a second chance in life when it comes to user experience.

$ads={1}

The slow speed of the site is one of the most unpleasant things for those people who are on your blog visit.

{tocify} $title={Table of Contents}

How to Lazyload Google analytics javascript code in Blogger

I think, All Blogger or a website owner used Google Analytics tools to track website traffic. For that we use a javascript codes in the website given by Google analytics and it can cause rendering to be blocked when loading a web pages.

In this article I will show you How to Lazyload Google analytics javascript code in blogger.

Yon can simply do it in your Blogger website  just following these easy tutorial...

Are Google analytics Impact on site Loading speed?

Google Analytics is a web analytics service that tracks and reports website traffic. This Google Analytics tool is a free tracking tool powered by Google, and it will give you complete information about how users use the our website.

However, after installing google analytics javascript code in blogger websites it may slow down the loading speed time of your blog as it runs. In total, Google Analytics adds to 3 HTTP requests, and it takes between 100 and 500 milliseconds. 

You can easily store them from time to time while Google Analytics code is loaded. 

Did you know that you can use it to improve page loading up to 100 milliseconds faster by introducing the google analytics code in the footer instead of the header section?

It may also decide to solve PageSpeed render-blocking Javascript and higher-fold content based on its errors. However, you can use it to improve page speed by lazyloading Google analytics code on your Blogger site.

Also Read: How to add your Blogger website to Google Search Console in 2021

How To implement Lazyloaded Google Analytics javascript in Blogger?

 Step 1.  First of all you Go to Blogger dashboard and tap on settings for removing the Google Analytics property ID ( if Allready added)

 Step 2.  Now click on Thems and tap on edit HTML and search for old analytics code if any found just remove it.

Friends, Generally the Google analytics javascript code will look like below and found it on before <head> tag or Close </head> section.

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


 Step 3.  Now you need to copy the below Lazyload google analytics script.

<!-- Global site tag (gtag.js) - Google Analytics -->
<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="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('js', new Date());
  gtag('config', 'UA-XXXXXXXXX-X');
</script>


 Step 4.  finely, Replace the Google analytics tracking code (Highlighted - UA-XXXXXXXXX-X) in both place of the code and save the  themes.

After save your theme the Lazyload Google analytics code is successfully added to your blogger website. Now check your analytics code, if it is properly working or not. 

In this simple way, you can implement google analytics code as Lazyload to blogger website and improve the loading speed of your website.

Read Also:

Conclusion

Friends, if you want to load faster your website, then this is a best option to choose.

If you have any questions or get any error about embedding Lazyload in google analytics code please ask me in comment.

For more updates on Blogger Templats, Blogging tutorial like this, please Follow this Blog

Debashis

Debashis is a Young Entrepreneur Blogger having Good Technical skills, He also an Experienced Article Writer. He likes to Share Knowledge and Experience with People. facebook whatsapp telegram instagram

Post a Comment

To be published, comments must be reviewed by the administrator.

Previous Post Next Post