PageView using the Canonical URL (<link rel="canonical">)


Is it possible that I trigger based on the canonical tag instead of the page URL in the browser address bar?

Thanks for help!


What do you mean exactly?

Often, several URLs lead to a specific page. But for all pages the same Canonical URL is stored in the source code:

<link rel="canonical" href="[URL]" />

Google Tag Manager offers the possibility to filter triggers according to Canonical tags. Now we want to switch to Matomo and I am looking for a solution how this works.

I would like to ask again: Does anyone have an idea how to implement this with the Matomo Tag Manager? Or do I have to implement this myself in the Tag via JavaScript?

Sorry, I don’t understand clearly what you achieve to do…
Canonical URL is placed in order to indicate crawlers which page is the original one (for some content). I don’t see the relation with the trigger… ? Can you provide some little very simple HMTL code and the tracking scenario)?

I would like to try to describe the tacking scenario:

I want a trigger to fire on a part of the website including all subpages. Which subpages these are in detail can always change. The canonical URLs contain the hierarchical structure, so I can filter by that. In the following example by “contains ‘/erf-plus/’”:

In the browser, these websites can also be accessed with other URLs:

Since the Canonical URL is unique for each page, I can use it to track individual pages or subpages much more easily. Otherwise I would have to consider all possible aliases of the URL individually.

This post was flagged by the community and is temporarily hidden.

I have tried to describe it in more detail here: Tigger using the Canonical Tag - #6 by grafikweb

Is it still hard to understand?

Then you just want to change the tracked page URL?
eg instead of
→ Create an MTM Variable based on the value of a DOM Element: Your <link rel="canonical" href="[URL]" /> must then have an ID (the same in all pages) in order for the variable to find the element - call it CanonicalUrl for example. Then your PageVue Tag must set the Custom URL with {{CanonicalUrl}}

I have found that there is already a preconfigured variable for the Canonical URL: {{SeoCanonicalUrl}}

However, in German it was translated as " Authorized URL". I could not imagine anything under this name.

With this my concern has been solved. Nevertheless, thanks for the suggestion to create a MTM variable.