Cross Domain Linking with Matomo Tag Manager

Hi all! Good to see all the nice people here!

I’m trying to set up cross domain linking with Matomo Tag Manager and I wasn’t able to find any clear instructions about how to do this.

I have a website at example.com and a web application (React) at app.example.com

Can anybody tell me how exactly should I set up Matomo and cross domain linking in Matomo Tag Manager, so that I’ll be able to track the full user’s path from the site to the app as a single journey?

Thank you!

Hi there,

To setup cross domain linking within Tag Manager, you will need to do the following steps:

1/ Edit the Matomo Configuration Variable
This is done from Tag Manager > Variables and editing the Matomo Configuration Variable. On this page scroll down and tick the option to enable “Cross Domain Linking”.
image
Scroll down the page further and you will have the “Domains” section, here enter the other domain you want to have for the cross domain linking.
image
Then click “Update” to save these changes.

2/ Publish the Container
Once the changes in step 1 have been made, you will need to publish the container to make these changes active. This is done from Tag Manager > Publish.

3/ Add the Tracking code
From Tag Manager > Install code you will find the tracking code for Tag Manager. This tracking code will need to be applied to both websites. e.g. example.com and app.example.com

If Cross Domain linking is enabled and working, the URL of app.example.com will contain a new parameter &pk_vid= when visiting from example.com. This pk_vid parameter will contain a string of data which includes the Visitor ID. This way the current visitor ID is forwarded to the page of the different domain e.g. pk_vid=77d0cdfaa881a07d17091942516b9bf9

1 Like

Okay, I’ll try it, thank you!