What is a canonical URL

This document provides insights into the concept of a "canonical URL."

What is canonical URL?

A canonical URL is the designated URL of a page that's deemed the primary version among several similar pages.

Consider this scenario: You have multiple URLs pointing to the same page, like https://channel.io/en/pricing and https://channel.io/en/pricing?show=true. Among these, one can be chosen as the canonical URL.

The Channel SDK determines the canonical URL as follows:

  1. It checks for the href property of the link tag with the rel property value set to “canonical”.
<link rel="canonical" href="{canonicalUrl}" />
  1. If no such link tag is found, the SDK then refers to the URL directly.

To verify if the SDK accurately identifies the canonical URL, you can test canonical URL here.
For detailed instructions, see the canonical URL.

Why Use Canonical URLs?

Canonical URLs play a important role in data analytics.

Imagine you have these two URLs:

  • https://channel.io/en/pricing
  • https://channel.io/en/pricing?show=true

The SDK might perceive these URLs as distinct, potentially displaying different content. Thus, when gathering data, such as traffic sources, they're treated as separate entities.

However, if both URLs share the same canonical URL, the SDK recognizes them as displaying identical content. Grouping similar pages under one canonical URL minimizes discrepancies, ensuring more accurate statistical interpretation.

When Should You Use Canonical URLs?

By default, the SDK references the canonical URL instead of the actual page URL. This is crucial when transmitting specific events or showcasing particular support bots. Therefore, to optimize event triggering and support bot performance, it's essential to configure the canonical URL correctly.