JavaScript SEO

JavaScript SEO is the work of making sure search engines and AI crawlers can see content that a website builds with JavaScript. When a page relies on JavaScript to load its text, links or metadata, a crawler has to run that code to see the page as a visitor does. Some crawlers do this. Many don’t.

Google can read your JavaScript-built page. ChatGPT and Claude’s crawlers can’t. A crawl-log study by Vercel and MERJ, published in December 2024, found that none of the major AI crawlers rendered JavaScript, including OpenAI’s GPTBot, OAI-SearchBot and ChatGPT-User, and Anthropic’s ClaudeBot. In the month measured, GPTBot made 569 million requests across Vercel’s network and Claude made 370 million. A page can rank first in Google and still look empty to the crawlers that feed AI answers, if its content only appears after JavaScript runs.

How Google handles JavaScript

Google’s JavaScript SEO documentation describes three phases: crawling, rendering and indexing. Googlebot fetches the HTML first, then queues the page to be rendered, and only then sees content that JavaScript adds. Google notes it isn’t always obvious whether a page is waiting to be crawled or waiting to be rendered. It won’t render JavaScript from files or pages blocked in robots.txt.

Google’s own advice still favours sending content in the HTML. Its documentation says server-side rendering or pre-rendering is still a great idea, because it makes sites faster for users and crawlers, and not all bots can run JavaScript.

Rendering methods compared

Method How the page is built What Google sees What AI crawlers see
Server-side rendering The server sends finished HTML for each request Full content on the first fetch Full content
Static generation or pre-rendering HTML is built ahead of time and served as files Full content on the first fetch Full content
Client-side rendering The browser downloads a near-empty page, and JavaScript builds the content Content after rendering, which is queued Only what’s in the initial HTML, often very little
Dynamic rendering Crawlers get a pre-rendered version, users get the JavaScript version The pre-rendered version Whatever version they’re served

Google lists dynamic rendering in its documentation as a workaround, not a long-term setup. Send the content in the HTML wherever you can.

Where B2B sites get caught

The risk on a B2B site is rarely the whole site. It’s the pages and elements that matter most to buyers:

  • Pricing tables and plan comparisons loaded from an API after the page appears.
  • Comparison widgets and calculators whose results only exist after a visitor interacts.
  • FAQ sections that fetch their answers when a question is clicked. An accordion that keeps the answer text in the HTML and only hides it is fine. One that loads the answer on click isn’t.
  • Marketing sites built as single-page apps with React or Vue, where every page starts as the same empty shell.
  • Product documentation hosted on a JavaScript platform, often the most detailed technical content a vendor publishes.

These are the pages AI tools draw on when a buyer asks how two vendors compare or what a service costs. If the answer only appears after JavaScript runs, the crawler behind that AI tool never sees it.

Metadata and JavaScript

Titles, canonical tags and robots directives are the riskiest things to set with JavaScript. Google’s canonical guidance says to put the canonical URL in the HTML source and make sure JavaScript doesn’t change it. For error pages on client-rendered sites, Google’s JavaScript documentation suggests adding a noindex robots meta tag with JavaScript, so a “page not found” view isn’t indexed as a real page.

How to check a page

  • View the page source (not the inspector) and search for a sentence from your main content. If it’s missing, every crawler that doesn’t render JavaScript misses it too.
  • Use Search Console’s URL Inspection tool to see the HTML Googlebot received after rendering.
  • Compare the two. Content that appears in URL Inspection but not in the page source is visible to Google but probably not to AI crawlers.
  • Check that robots.txt doesn’t block the JavaScript and CSS files your pages need to render.

Common mistakes

  • Assuming that because Google renders JavaScript, every crawler does.
  • Checking pages only in a browser, which always runs the JavaScript.
  • Setting or changing canonical tags with JavaScript.
  • Blocking script files in robots.txt, which stops Google rendering the page.
  • Loading pricing, comparisons or FAQ answers only on interaction.

Related terms

Crawl budget · Canonical tag · Robots.txt · Core Web Vitals · Answer engine optimisation

Let's build a AI SEO search strategy that actually delivers.

Book a consult to see where your current search visibility stands, on Google and across AI search, and what is actually possible from here.