On this page
What this issue is
A canonical tag is a line in the <head> that tells search engines which URL is the main version of a page. Google reads it twice: once in the raw HTML the server sends, and again in the rendered HTML after JavaScript has run.
This issue appears when those two versions disagree. For example, the raw HTML says https://example.com/shoes/ while a script rewrites it to https://example.com/shoes/?color=red, or to the home page. Common sources are Google Tag Manager custom HTML tags, single-page app frameworks, A/B testing tools and SEO plugins that run alongside theme code.
- Server sends HTMLCanonical points to /shoes/
- JavaScript runsScript rewrites canonical to /shoes/?color=red
- Google renders pageSees two different canonicals
- IndexingWrong URL may be chosen or both ignored
The server and the script each declare a different canonical.
Why it costs you leads or sales
Google says that if canonical signals conflict, it may pick one or ignore them. That means the page you want to rank can be treated as a duplicate of another URL. Ranking signals may then split across versions, or the wrong version (a filtered, parameter or tracking URL) shows in results.
For landing pages and product pages this hurts twice. Traffic lands on a URL you did not plan for, and your reporting then shows organic visits against the wrong pages. Impact is usually medium: it rarely removes a page overnight, but it quietly weakens rankings.
Day 0
A tag manager tag is added that sets the canonical from the current URL.
Week 1
Google crawls and renders pages. Raw and rendered canonicals differ.
Week 3
Parameter URLs start appearing in the index instead of clean URLs.
Week 4
Script is removed, both canonicals match, and Google reprocesses over time.
How to check if your site has it
View the raw HTML
Open the page in Chrome, press Ctrl+U (Cmd+Option+U on Mac) to open view-source, and search for
canonical. Note the URL.View the rendered HTML
Right-click the page, choose Inspect, and in the Elements panel search for
rel="canonical". This shows the DOM after scripts ran. Note the URL.Compare with Google's view
In Google Search Console, use URL Inspection, then View crawled page (HTML) and Test live URL. Compare the canonical there with the raw source. Also check which canonical Google selected under Page indexing.
Check in bulk
A crawler such as Screaming Frog can crawl with JavaScript rendering on and list pages where the raw and rendered canonicals differ. Run it on key templates first: home, category, product, landing pages.
document.querySelectorAll('link[rel="canonical"]').forEach(function (l) { console.log(l.href); });Paste the snippet into the browser console on a page. Then compare the output with the canonical in view-source. If they differ, a script is changing it.
How to fix it
The safest rule: output the canonical once, on the server, in the <head>. Then make sure nothing in the browser edits it. Find which script does the change first, using the Elements panel (right-click the tag, Break on, attribute modifications) or by pausing tags in Tag Manager preview mode.
Run one canonical source
Yoast, Rank Math, All in One SEO and some themes can each print a canonical. Keep one and disable the canonical output in the others.
Check for scripts
Look in your theme's header and any header or footer script plugin for code that sets
link[rel=canonical]. Remove it.
Use the theme's canonical
Themes normally print
<link rel="canonical" href="{{ canonical_url }}">in theme.liquid. Keep that line.Remove scripts that edit it
Check installed apps and any custom code in theme.liquid for JavaScript that changes the canonical, and remove or reconfigure it.
Find the tag
In Preview mode, look for Custom HTML tags or variables that create or edit a canonical link.
Pause or delete it
If the server already outputs the canonical, remove the tag. If you must keep it, make it set the exact same URL as the server, with no query string.
Publish
Publish the container version and recheck the rendered canonical.
Set it in page settings
Use Page settings, then SEO settings, and the canonical tag field, or the site-wide setting for the default. Webflow prints it in the HTML.
Remove custom code
Search Custom code (head and footer, and page-level) for scripts that modify the canonical and delete them.
Check page tracking code
Open the funnel or website page settings and review Head tracking code and custom JavaScript for scripts that set a canonical.
Remove the conflict
Delete the script, or make it match the canonical URL you want, then republish.
Use the SEO panel
Wix manages canonicals through its SEO settings. Avoid adding your own via Custom Code (Settings, Custom code) that creates a second one or edits it.
Leave the built-in canonical
Squarespace adds canonicals automatically. Remove any Code Injection (Settings, Advanced, Code Injection) that changes it.
Render it server-side
Output the canonical in the initial HTML response (server-side rendering or static generation). With React Helmet, Next.js metadata or Vue Meta, make sure the value is present in the server response, not only after hydration.
Delete client-side overrides
Remove code like
document.querySelector('link[rel=canonical]').href = location.href, which copies parameters into the canonical.
<head>
<link rel="canonical" href="https://example.com/shoes/">
</head>Before
- Raw HTML canonical: /shoes/
- Rendered canonical: /shoes/?color=red
- Google may choose either URL
After
- Raw HTML canonical: /shoes/
- Rendered canonical: /shoes/
- One clear signal for Google
How to confirm it's fixed
- View-source and the Elements panel show the same canonical URL.
- Only one canonical tag exists in the rendered page.
- The canonical is absolute, uses https and has no tracking parameters.
- URL Inspection in Search Console shows the same canonical in the crawled HTML.
- A JavaScript-rendered crawl shows no canonical mismatches on your key templates.
Then request indexing for important URLs in Search Console. Google re-evaluates canonicals as it recrawls, so changes in the index can take days to weeks.
How to prevent it happening again
- Name one owner for canonicals: the CMS, theme or SEO plugin, never several.
- Ban canonical edits in Tag Manager unless an SEO reviews them.
- Add a raw versus rendered canonical check to your release checklist.
- Re-run a JavaScript-rendered crawl after theme, plugin or framework updates.
- Review Page indexing in Search Console for new 'Duplicate' or 'Alternate page with proper canonical tag' groups.
How FunnelGuard handles this
FunnelGuard does not check this yet. Comparing raw and rendered canonicals is a possible future check, but today it is not part of what FunnelGuard monitors.
What FunnelGuard does cover is nearby: a robot visitor runs your real journeys (lead forms, checkouts, booking and chat buttons) on a schedule and checks each step and the tracking hits sent to platforms such as GA4, Google Ads and Meta. If a tag change breaks a step or a tracking hit, you get one alert with a screenshot and a likely cause. It will not tell you that your canonical differs.
To watch for this yourself, schedule a monthly JavaScript-rendered crawl (for example in Screaming Frog) and compare raw and rendered canonicals, and check Search Console's Page indexing report after each release. You can also start with the free read-only website audit, or the Free plan (1 site, 2 journeys, daily checks, no card), to monitor your funnels in the meantime.
Questions people ask
Why is my canonical tag different in view-source and Inspect?
View-source shows the HTML the server sent, while Inspect shows the page after JavaScript ran. If they differ, a script such as a tag manager tag, framework or plugin is changing the canonical after load.
Does Google read a canonical set by JavaScript?
Yes. Google renders pages and can read canonicals in the rendered HTML. But it advises that the raw and rendered canonicals should match, and that a canonical set only by JavaScript is less reliable than one in the server HTML.
What happens if the raw and JavaScript canonicals conflict?
Google may use either one or ignore both and choose its own canonical. This can split ranking signals or put the wrong URL, such as a parameter version, in search results.
How do I find which script changes my canonical tag?
In Chrome DevTools, right-click the canonical link in the Elements panel and choose Break on, then attribute modifications. Reload the page and the debugger stops on the script. You can also pause tags in Google Tag Manager preview mode.
Can I set a canonical tag with Google Tag Manager?
You can, but it is risky. The tag runs after the page loads, so it can conflict with a canonical already in the HTML. Prefer setting it in the CMS or theme so it appears in the server response.
How do I check rendered canonicals across a whole site?
Use a crawler with JavaScript rendering enabled, such as Screaming Frog, and compare the raw and rendered canonical columns. Check a sample of each template if the site is large.
Does FunnelGuard detect canonical mismatches?
No. FunnelGuard does not check canonical tags yet. It monitors journeys, tracking hits and lead delivery, so use a rendered crawl and Search Console to watch for this issue.
Related issues
- SEO-047Canonical in the body, not the head, or multiple canonicalsFix guide
- SEO-052Google chose a different canonical than declaredFix guide
- SEO-042Missing rel=canonical on indexable pagesFix guide
- SEO-058UTM or click-ID parameter URLs indexed as duplicatesFix guide
- SEO-043Canonical points to a 404, redirect or noindex URLFix guide
- SEO-044Canonical points to the home page from every pageFix guide