Javascript for SEO – Is it good or bad?

Author
Category
Time to read
0 minutes
Date

Introduction

Javascript can be used to add interactive elements to a website. Sometimes developers use it for rendering the main content of a webpage which can cause indexing issues. Learn how to correctly use Javascript and how to avoid the most common issues that can be caused by using javascript on your website.

What is Javascript SEO?

JavaScript SEO is a discipline of technical SEO. It is focused on optimizing websites developed with JavaScript or Javascript frameworks like React. It’s primarily concerned with: Diagnosing crawling and indexing issues, core web vitals, increasing page speed and much more. Javascript should be used to add interactive elements to a website but sometimes developers are using it for rendering the main content of a webpage which can cause indexing issues.

Javascript websites can be bloated with third-party libraries and can suffer from indexing and rendering issues. There are different strategies to detect javascript indexing issues.

What is javascript best used for?

Most of the main content of a website is in the HTML and CSS part. Javascript allows to add additional functionality to a website. Javascript can make a website much more interactive and allows the website to respond to events. Here are just some of the many things Javascript can do for you:

  • Javascript can help store useful values inside variables and cache them. For example, it can be stored if the user has already been served the email newsletter popup. The user session can also be stored over a certain time period preventing the user needs to log in again and again.
  • You can run code in response to certain events occurring on a web page. For example, if you run a search engine and the user clicks on ‘Search’, you can run code in response to the button click (i.e. you let the backend perform the search and return the search results). Another example is form validation. If you require the user to enter an email address, javascript can check if the user input in the email field is in the right format (i.e. [email protected])
  • JavaScript allows users to interact with web pages.
    • Show or hide more information with the click of a button
    • Slide through a carousel of images on the homepage
    • Zooming in or zooming out on an image
    • Using a drop-down hamburger menu
    • Playing audio and video on a web page
    • … and much more

Is Javascript good for SEO?

Javascript might not directly positively affect indexing and rendering but it helps you to build an incredibly useful website. Creating a helpful website and solving the customer’s problem is one of the best things you can do for SEO. Google is generally interested in showing users search results that answer their questions or solve their problems. There are hundreds of ranking factors and being able to fulfil the search intent is one of the most important things you can do.

  • If your website is totally irrelevant – users will leave fast and never return (high bounce rate, low retention)
  • If a user clicks on your website and you solve his problem, the user will not click on other search results. This is a signal to google that you have fulfilled the search intent.
  • The user might remember that you have solved his problem and google your website name next time (increase in branded traffic, high retention rate, increases sessions per user)
  • If your website is good, users might share your article on social media (good)
  • If your website is good, users might talk to their friends about it who then will google your website (good)

Is Javascript bad for SEO?

Javascript can cause a lot of issues if you use it to render the main content of the website. Most disadvantages of Javascript listed here are mostly due to poor developer coding standards. Here is a list of common javascript issues.

Depending on the size of your website, google assigns a certain crawl budget for you. Data-heavy JavaScript websites use more of your budget crawl than plain HTML sites. Should you have a huge website with thousands of pages, they might never be crawled and indexed because Googlebot exhausted its budget and stopped crawling your website.

One solution is to prerender your pages in static HTML that Google can easily see and read (and thus take up way less of your crawling budget). There are several ways to do so. Next.JS offers static and incremental static generation. To optimise your website for SEO, there are solutions like prerender.io which detect if the current user is a search engine crawler and a lightweight HTML version is served (instead of the javascript-heavy version of the website).

Some websites import a lot of third-party JS libraries. You can see all the imported third-party libraries when you click on Treemap at dev.web.pagespeed. Asynchroneseouly loading third-party libraries can be a quick fix to improve the page speed.

Having website indexing issues?

Check out our blogs on the most common indexing issues and how to fix them. Fix your page indexing issues

Looking for an SEO Consultant?

Find the best SEO Consultant in Singapore (and worldwide). Best SEO Consultant

Is this you?

💸 You have been spending thousands of dollars on buying backlinks in the last months. Your rankings are only growing slowly.


❌You have been writing more and more blog posts, but traffic is not really growing.


😱You are stuck. Something is wrong with your website, but you don`t know what.



Let the SEO Copilot give you the clicks you deserve.