What is 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:
- It checks for the
href
property of thelink
tag with therel
property value set to“canonical”
.
<link rel="canonical" href="{canonicalUrl}" />
- 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 workflows. Therefore, to optimize event triggering and workflow performance, it's essential to configure the canonical URL correctly.
Updated 5 months ago