Now Google makes blog loading speed a ranking factor in search results, so we should optimize the loading of the blog. Here you can use Google PageSpeed Insights to find out why your blog is loading slowly.
Google analytics is one of the blog statistics tool with SEO elements, so we should keep it installed on our blog, we can use Lazy Load Script to overcome google analytics loading problem.
Usually Lazy Load is Often installed on images and Adsense. For example Lazy Load normally works to delay the loading of some items so that they are loaded until scrolling activity occurs and in this post I will share how to lazy load Google Analytics.
What is LazyLoad Google Analytics ?
Lazy Load is a plugin developed by Script Developers to reduce the load on Google Analytics web pages. So by installing this Google Analytics Lazy Load Script you can also improve your website performance, as it temporarily delays the loading of CSS, Javascript, Image files.
The way this Google Analytics Lazy Load Script works is to temporarily delay the loading of Javascript from Google Analytics, and get back to work as you scroll through the web page.
Benefits of Installing LazyLoad Google Analytics Script :-
The advantage of installing Google Analytics Lazy Load Script is that it can lighten the load of Javascript load provided by Google Analytics. Another benefit is that you can increase your score on PageSpeed, GTMetrix, or Web.dev.
Surely visitors will be happier if they reach your website much faster than other websites. That's why you should use this Lazy Load Google Analytics Script.
How To Add LazyLoad Google Analytics in Blogger :-
Installing Google Analytics Lazy Load Script is quite easy, you can copy the script given below. And you need to remember, this script is for those of you who have used Google Analytics to find out your website statistics, and if you haven't installed these tools, you can click here You can install Google Analytics.
<script async='async' src='https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx-x'/>
<script>
//<![CDATA[
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxx-x');
//]]>
</script>
</body>
and then paste the new lazy loaded Google Analytics code given.
<script type="text/javascript">
//<![CDATA[
var lazyanalisis=false;window.addEventListener("scroll",function(){(0!=document.documentElement.scrollTop&&false===lazyanalisis||0!=document.body.scrollTop&&false===lazyanalisis)&&(!function(){var e=document.createElement("script");e.type="text/javascript",e.async=true,e.src="https://www.googletagmanager.com/gtag/js?id=UA-163xxxxxx";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyanalisis=true)},true); window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','UA-163xxxxxx');
//]]></script>
Conclusion :-
In this post I have shared with you all How To Add LazyLoad Google Analytics in Blogger. So how did you like this post, you can tell by commenting and if you have any question then you can comment your question. Thanks for visiting our website.