Skip to content
FunnelGuard

Fix guide by FunnelsGuard

noindex injected by JavaScript: how to find and fix it

SEO-031Medium impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

A robots meta tag is a line in the page head that tells search engines whether to index the page, for example <meta name="robots" content="noindex">. Normally it is written into the HTML by your server or CMS.

With this issue, the HTML your server sends says nothing, or says index. Then JavaScript runs in the browser and adds or edits the tag so it says noindex. The rendered DOM (the page after scripts have run) differs from the raw HTML (what View Source shows). Google processes both, and a noindex found after rendering can still remove the page.

Why it costs you leads or sales

A noindexed landing page cannot appear in Google results, so organic visitors who would have filled in the form or bought never arrive. It is easy to miss because the page works for every visitor and looks fine in View Source. You often notice only when traffic to the page slowly falls or the page shows as Excluded in Search Console.

How a late noindex removes a page from search
  1. Raw HTMLRobots tag says index or is missing
  2. Script runsJavaScript adds noindex to the head
  3. Google rendersSees noindex in the rendered DOM
  4. Search resultsPage dropped from the index
  5. Organic leadsNo visitors from search

The raw HTML looks fine, so the problem hides until Google renders the page.

Organic visits to an affected landing pageExample numbers
Organic visits to an affected landing page (example)Week 1: 420 visits per week; Week 2: 410 visits per week; Week 3: 260 visits per week; Week 4: 90 visits per week; Week 5: 15 visits per week01613224204102609015Week 1Week 2Week 3Week 4Week 5visits per week

Example: illustrative numbers showing traffic fading after Google re-renders the page and honours the noindex.

How to check if your site has it

Compare raw HTML and rendered DOM
  1. Read the raw HTML

    Open the page, press Ctrl+U (Cmd+Option+U on Mac) and search for robots. Note what the tag says, or that it is missing.

  2. Read the rendered DOM

    Right-click the page, choose Inspect, then in the Elements panel search (Ctrl+F) for name="robots". If it says noindex here but not in View Source, a script wrote it.

  3. Run the console check

    In the DevTools Console, run the snippet below. It prints the live robots value.

  4. Ask Google what it sees

    In Search Console, paste the URL into URL Inspection and choose View crawled page or Test live URL, then check the HTML tab and the Indexing section for 'Excluded by noindex tag'.

  5. Find the culprit

    In DevTools open the Sources tab and search all files (Ctrl+Shift+F) for noindex. Also check your tag manager's Preview mode for tags that fire on the page.

Print the live robots meta valuesjavascript
document.querySelectorAll('meta[name="robots"], meta[name="googlebot"]').forEach(function (m) {
  console.log(m.name + ': ' + m.content);
});

How to fix it

Remove the script-added noindex
  1. Find the tag

    In Preview mode load the page and look for Custom HTML tags that contain noindex or robots.

  2. Fix the trigger or remove it

    Delete the tag, or narrow its trigger so it never fires on live, indexable pages (for example staging hostnames only). Then Submit and publish the container.

What an indexable page should have in the headhtml
<meta name="robots" content="index, follow">

How to confirm it's fixed

Confirmation checklist
  • View Source shows no noindex in any robots or googlebot meta tag
  • The console snippet prints index, follow or nothing
  • Search Console URL Inspection > Test live URL shows the page is indexable
  • Request indexing for the URL in URL Inspection
  • The page returns to the Indexed state in Search Console over the following days

How to prevent it happening again

Prevention habits
  • Keep robots rules in one place, ideally server-rendered, and avoid scripts that edit them
  • Scope staging-only tags to staging hostnames in your tag manager
  • Review tag manager and plugin changes in Preview mode before publishing
  • Re-check the rendered DOM of key landing pages after every theme, plugin or tag change
  • Watch the Pages report in Search Console for new 'Excluded by noindex tag' URLs
Raw HTML versus rendered page

Broken

  • View Source shows index or no robots tag
  • Rendered DOM contains noindex
  • Search Console reports Excluded by noindex tag

Fixed

  • Raw HTML and rendered DOM agree
  • No script touches the robots tag
  • Page is indexed and receives organic visits

How FunnelGuard handles this

FunnelGuard covers this issue partly. On your journey pages, it reads the robots meta tag from the rendered DOM, meaning the page after scripts have run, so a noindex written by JavaScript is visible to it.

What it does not do: it does not compare the result against the raw server HTML, it does not check what Google has actually indexed, and it does not look at pages outside your journeys. It also cannot tell you which script wrote the tag.

To cover the rest by hand, use the steps above: compare View Source with the rendered DOM, run URL Inspection in Search Console for your key pages, search your code and tag manager for the script, and review the Pages report in Search Console for noindex exclusions on other URLs. The Free plan (1 site, 2 journeys, daily checks, no card) lets you try the journey checks, and a free read-only website audit is available.

Questions people ask

Can JavaScript add a noindex tag after the page loads?

Yes. A script can create or edit the robots meta tag in the page head after load. Google renders JavaScript, so it can see that noindex and may drop the page from its index.

Does Google obey a noindex added by JavaScript?

Generally yes, if Google renders the page and sees the noindex in the rendered DOM. Rendering can happen later than the first crawl, so the page may be indexed first and removed afterwards.

Why is my page indexed in View Source but excluded by noindex in Search Console?

Most likely a script adds noindex after the page loads, so the raw HTML looks clean. Compare View Source with the rendered DOM in DevTools and use URL Inspection to see the HTML Google rendered.

How do I find which script is adding noindex to my page?

Search all loaded files in DevTools (Sources, Ctrl+Shift+F) for noindex, and check Preview mode in your tag manager for Custom HTML tags. If that finds nothing, disable plugins or apps one at a time and re-run a console check of the robots meta tag.

Is it safe to remove noindex with JavaScript instead of fixing the HTML?

No. If the raw HTML contains noindex, Google may act on it before or without running your script. Put the correct robots tag in the server-rendered HTML.

How long does it take to get reindexed after removing the noindex?

It varies and nobody can promise a fixed time. After the fix, use URL Inspection to request indexing and monitor the Pages report in Search Console for the status change.

Can a tag manager tag cause a noindex on my live site?

Yes. A Custom HTML tag meant for staging can fire on production if its trigger is too broad. Check Preview mode and limit such tags to staging hostnames.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: Robots meta read from rendered DOM on journey pages.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.