Chess pieces, with a black pawn standing out from the white

Canonical Tags

Canonical tags are a single line of code that goes into the source code of a page to tell Google that it should ignore any duplicates of the page that it may find.

For example, if you view the source code of this page, you’ll see a line that reads:

<link rel=”canonicalhref=”https://josefsarmast.com/technical-seo/canonical-tags/” />

How does this work and why is this important?

Google wants all your pages to be unique, whereby each URL of your site serves unique content. This is generally not a problem if you have a small and basic site, but it can become one if your site offers sorting or filtering or if you use certain tracking code to add on to the end of your URLs.

Here’s how this works in practice:

1. Offering sorting or filtering on your site.

Let’s say you have a product page on your website selling shoes

http://www.yoursite.com/products/brand/shoes.html

If you offer sorting or filtering on this page, the URL is going to change, but you’re essentially showing more or less the same content. Say you select sorting per price  (high to low)  from this URL and you’re served the resorted list of shoes at this URL:

http://www.yoursite.com/products/brand/shoes/asc/price.html

Now, there is a chance that Google will be confused about which URL to index. In order to make sure Google aware that you only want one version in its index, and the best choice is the basic URL, you would set the canonical tag in the source code of the page to read:

http://www.yoursite.com/products/brand/shoes.html

When Google tries to access the URL http://www.yoursite.com/products/brand/shoes/asc/price.html it will see that you prefer the canonical version of the page http://www.yoursite.com/products/brand/shoes.html to be included in its index and, in theory, your Google rankings will not be negatively affected.

2. If you use certain tracking code that requires you to add on to the end of your URLs.

In this scenario, you use tagging at the end of your URL. This could be to track users from a particular source or using a particular user or session ID.

Let’s say you want to send your user database a newsletter announcing the great sales you have on and you add a snippet of tracking code to the end of the URLs to let your tracking software know that’s where a visitor came from.

This means the URL visitors go to is:

http://www.yoursite.com/products/brand/shoes.html&source=newsletter

This has the benefit that you can accurately track visitors you’ve gotten from your newsletter, and distinguish them from visitors who have gone to your site from other sources. Unfortunately, if this URL ends up being shared elsewhere online, maybe if a person who received the newsletter decides to put the link up in a forum, Google could find and index this URL and see that it offers exactly the same content as http://www.yoursite.com/products/brand/shoes.html at a different URLs.

In short, If you can set the canonical tag for each page to its own “naked”/plain URL at site launch, campaign start or when a new page is added, this should safeguard your site against duplication issues.