How to Remove Unused JavaScript from Blogger Website in 2021

How to Remove Unused JavaScript from Blogger Website

When reading this article, you may have tested your blog on Google PageSpeed ​​Insights and found opportunities for optimizing your blog’s page speed by removing unused javascript as you can see in the results of the PageSpeed ​​Insights analysis below:

Unused JavaScript- PageSpeed Insights report

As you know Core Web Vitals has become ranking signals from May 2021. In this update, the main factors of Core Web Vitals are First Input Delay (FID), Cumulative Layout Shift (FID), and Largest Contentful Paint (LCP).

These factors all about Website Speed. So we can say that, to pass Core Web Vitals and to rank higher in search results, you have to focus on website speed.

Don’t worry because in this article I will explain a trick or tutorial to remove Unused Javascript in the blogger blog template.

But first, let’s look at how there can be unused javascript in the blogger template even though the blogger and blog templates have been professionally designed.

Remove Unused javascript from blogger widget

Example of Blogger widget:

<script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/277321023-widgets.js"></script>

Basically, the blogger widget script bundle is very useful and functions to run blogger widgets such as comment form widgets, contact forms, feeds, and others. But when the widgets are not installed then the bundle script automatically does not work or becomes unused javascript.

Then even though all the widgets are installed on your blog, the location of the widgets may be on different pages so that still on some pages unused javascript will be detected when tested with Google PageSpeed ​​Insights.

So, the best solution for dealing with unused javascript is to disable the blogger widget bundle script so that it is not detected as unused javascript, the method is as follows:

How to Remove Unused JavaScript Blogger

  1. Login to Blogger
  2. Click the ” Template “
  3. Then select Edit HTML
  4. Scroll all the way down, and
  5. Replace these tags: <head> with &lt;head&gt; | </head> with &lt;!–&lt;head&gt;</head>

Thus unused javascript will disappear from your blogger template and Blog Page Speed will increase, but there is a new problem that can arises, namely, blogger widgets that require a script bundle cannot work properly, including the reply comment button also does not work. So do it properly.

How to Remove Unused JavaScript from Adsense Script

To overcome unused JavaScript that comes from the Adsense script bundle is easier when compared to removing unused javascript blogger because to delete unused javascript AdSense there is no risk to the blog mechanism, here’s the trick.

Use the Adsense lazy load script below to run your Adsense ads:

<script type='text/javascript'>
//<![CDATA[
var lazyloadads=false;window.addEventListener("scroll",function(){(0!=document.documentElement.scrollTop&&false===lazyloadads||0!=document.body.scrollTop&&false===lazyloadads)&&(!function( ){var e=document.createElement("script");e.type="text/javascript",e.async=true,e.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle .js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}(),lazyloadads=true)},true);
//]]></script>

By using the lazy load Adsense script, loading the blog will feel lighter (faster) and there is no more unused javascript caused by the Adsense ad code on your blog.

In addition to the blogger widget script bundle and Adsense script bundle, unused javascript can also be caused by third-party plugins. It’s better if third party plugins only work on special pages then the plugin script bundle is also installed on that page only.

In the sense that doesn’t install the bundle script in HTML template to avoid unused javascript on other pages.

Conclusion – Need Our Help?

I think until here my explanation about the trick to remove unused javascript blogger either from blogger widget or Unused JavaScript from third parties is useful.

If your blog ranking going down just because of Core Web Vitals update, and you don’t know what to do and how to do it? Then don’t worry. We will fix your all Core Web Vitals errors. So that you can rank higher again.

We have a development team that fixes CWV (Core Web Vitals) errors significantly for our clients for highest Website Speed and Performance. So drop us a message or see our Affordable Pricing if you’re struggling with Core Web Vitals stuff, and we’ll fix all Core Web Vitals errors for you.

Hopefully, this article is useful and can help you in optimizing your blog.

Hit the share button ❤️

3 thoughts on “How to Remove Unused JavaScript from Blogger Website in 2021”

    1. Hello Kedar!

      To add adsense Lazy Load script, Open Blogger >> Click on the themes menu >> Click the Edit HTML button >> Enter the code just above the tag.

      Let us know if you have any other questions.

      Kind regards
      Vishal Meena

  1. My website was very slow earlier. But after reading your article, I made some improvements in it, after which the performance of my site has become very good. Thank you for helping us

Leave a Comment

Your email address will not be published. Required fields are marked *