Canonical URLs and Tracking Parameters
By Urlzee Team · Published · 6 min read
Tracking parameters such as utm_source make new URLs for the same page, and a canonical tag tells search engines which one is the real address. Put <link rel="canonical"> pointing at the clean URL on every page, keep parameters off your internal links, and tagged campaign links will not compete with the page they point to.
Why do tracking parameters create duplicate URLs?
Because to a crawler, any difference in a URL makes it a different URL. These three addresses all return the same product page:
https://example.com/products/linen-apron
https://example.com/products/linen-apron?utm_source=newsletter&utm_medium=email
https://example.com/products/linen-apron?fbclid=AbC123
Your server ignores the extra parameters and serves identical HTML. A search engine that finds all three has to work out that they are one page and choose which to show. Usually it does so correctly. The canonical tag removes the guesswork.
Tagged URLs get discovered more often than people expect. They are shared in public posts, copied out of emails onto forums, and added automatically by ad platforms in the form of click IDs such as gclid, fbclid and msclkid.
What does a canonical tag do?
It names the preferred URL for a page's content. It goes in the <head>:
<link rel="canonical" href="https://example.com/products/linen-apron">
When a search engine crawls the tagged variant and sees this, it treats the variant as a duplicate of the clean URL and consolidates signals such as links onto that one address.
Two properties are worth understanding:
- It is a hint, not a command. Google describes
rel="canonical"as a strong signal that it weighs with others, such as redirects, internal links and sitemaps. If those contradict the tag, the tag may be overridden. - It works per page. Every URL variant that should be consolidated has to serve the tag. In practice that means the page template emits it on every request.
For non-HTML files such as PDFs, the same statement can be sent as an HTTP header: Link: <https://example.com/guide.pdf>; rel="canonical". Google's guidance on all the methods is in how to specify a canonical URL.
How should you set canonicals when you use UTM links?
Use a self-referencing canonical built from the page's known clean address, not from the incoming request.
- Emit a canonical on every indexable page that points to that page's own clean, absolute URL, including
https://and the correct host. - Build it from your routing or CMS data. Do not echo the request URL. A template that does this turns
?utm_source=newsletterinto part of the canonical and defeats the purpose. - Keep content-changing parameters deliberately. If
?page=2or?colour=blueproduces genuinely different content that you want indexed, that is a separate decision. Strip tracking parameters; think about the rest. - List only canonical URLs in your XML sitemap.
- Match
og:urlto the canonical so that social platforms attribute shares to one address. - Verify. Load a tagged URL, view the source and confirm the canonical is the clean one.
A quick check from the command line:
curl -s "https://example.com/products/linen-apron?utm_source=test" | grep -i 'rel="canonical"'
The output should show the URL without utm_source.
Which parameters are safe to leave out of the canonical?
Any parameter that does not change what the page shows. A rough classification:
| Parameter type | Examples | Changes content? | In canonical? |
|---|---|---|---|
| Campaign tags | utm_source, utm_medium, utm_campaign, utm_term, utm_content, utm_id | No | No |
| Ad click IDs | gclid, fbclid, msclkid | No | No |
| Session or referral markers | ref, sessionid | No | No |
| Sorting and display | sort=price, view=grid | Order only | Usually no |
| Pagination | page=2 | Yes | Usually yes, each page canonical to itself |
| Variants and filters | colour=blue, size=m | Sometimes | Depends on whether the variant deserves its own listing |
| Language or region | lang=fr | Yes | Yes, with hreflang |
The top three rows are the ones this article is about, and the answer for them is always the same.
What mistakes break canonicalisation?
Most come from trying to solve the problem a second way and creating a conflict.
- Blocking parameter URLs in
robots.txt. A blocked URL cannot be crawled, so its canonical tag is never seen. The URL can still end up indexed from external links, without its content. - Adding
noindexto tagged variants.noindexandcanonicalsay different things about the same URL. Choose the canonical. - Redirecting tagged URLs to the clean URL on the server. A 301 that strips the query string does tidy up the address, but the redirect happens before any analytics script runs. The campaign tags are gone by the time the page loads, and the visit is recorded with no campaign.
- UTM tags on internal links. Tagging a link from your homepage to a product page starts a new campaign in analytics and overwrites the visitor's real source. It also fills your own site with parameterised URLs for crawlers to find. Use UTM tags only on links from outside your site. This is one of the classic UTM mistakes.
- Canonicals that are relative or point to a redirect. Use a full
https://URL that returns 200. - Relying on a search console setting. Google retired the URL Parameters tool that once let site owners declare how parameters should be handled, so the signals now have to be on the pages.
Does the canonical tag affect analytics?
No. The two systems read different things.
Analytics tools such as GA4 take campaign information from the URL in the visitor's address bar when the page loads. The canonical tag is in the HTML for crawlers and plays no part in attribution. A visit to ...?utm_source=newsletter&utm_medium=email is credited to the newsletter whatever the canonical says.
If you want clean URLs in the address bar as well, for example so that visitors who copy the address do not pass your tags on to their friends, the safe method is on the client: let the analytics script record the page view first, then remove the tracking parameters with history.replaceState. Order matters. Strip them before the tag fires and you have recreated the server-redirect problem.
For where the tags end up once they are recorded, see UTM parameters in GA4.
What about caches and CDNs?
Tracking parameters can quietly reduce your cache hit rate. Many caches use the full URL, query string included, as the cache key. Every unique fbclid then looks like a page the cache has never seen, and the request goes through to your origin server.
Most CDNs and reverse proxies let you configure which query parameters are part of the cache key. Excluding known tracking parameters means all variants are served from the same cached copy. The parameters still reach the browser in the address bar, so analytics is unaffected. Only do this for parameters that truly do not change the response.
How do short links fit in?
A short link moves the tracking parameters out of sight without changing any of the above. The pattern is:
- Build the tagged destination with a UTM builder.
- Shorten it with the URL shortener, so the link people see is
https://urlzee.com/apron-news. - The short link redirects to the full tagged URL. Analytics reads the tags there, and the page's canonical points to the clean address.
The short URL itself is not a page and does not need a canonical. Urlzee answers every short link with a 302 and an X-Robots-Tag: noindex, nofollow header, so the short address is kept out of search results and the destination page is the only thing to index. How search engines treat such redirects is covered in do short links hurt SEO?.
One check is worth doing after you set this up. Paste the short link into the URL expander and confirm that the final URL still carries every parameter. If your own site redirects, say from non-www to www, make sure that redirect preserves the query string. Losing it there is a common reason for campaign traffic appearing as "direct".
A short checklist
- Every indexable page has a self-referencing canonical with a clean, absolute URL.
- The canonical never contains
utm_parameters or click IDs. - Parameter URLs are crawlable, not blocked or noindexed.
- Internal links and the sitemap use clean URLs only.
- Redirects on your site keep the query string.
Frequently asked questions
- Do UTM parameters cause duplicate content?
- They create extra URLs that return the same page, which is duplication in the technical sense. A rel=canonical tag pointing to the clean URL tells search engines which version to index, so it does not become a ranking problem.
- Should the canonical URL include UTM parameters?
- No. The canonical should be the clean address of the page without tracking parameters. A common bug is a template that builds the canonical from the full request URL and so copies the UTM tags into it.
- Does a canonical tag stop Google Analytics from reading UTM parameters?
- No. Analytics scripts read campaign parameters from the address the visitor actually loaded. The canonical tag is an instruction for search engines and has no effect on how visits are attributed.
- Should I block URLs with tracking parameters in robots.txt?
- No. If a crawler is blocked from a URL it cannot see that page's canonical tag, so it cannot consolidate that URL with the clean version. Let the pages be crawled and rely on the canonical.
- Do short links need a canonical tag?
- No. A short link is a redirect, not a page, so there is nothing to put a tag in. Search engines follow the redirect to the destination, and that page's own canonical tag applies.