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.
How To Add LazyLoad Google Analytics in Blogger
<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>
<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>
Note :- Change the Google Analytics Tracker ID I've Marked
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 and tell me by commenting. If you have any question then you can comment. Thanks for visiting our website.
Refrence :
Smart Tech Carry
Rate This Article
Thanks for reading: How To Add LazyLoad Google Analytics in Blogger ?:)
Conclusion
In this article, I have shared How To Add LazyLoad Google Analytics in Blogger ?. I hope you have liked it Please do share it with your friends and follow our blog for more.
Join our Telegram Channel to get the lastest posts updates daily. Thank you!
