Pk_vid parameter not appended where GA parameters are

Hi there,

I am setting up cross domain tracking through Piwik Pro. The URLs are added in the settings and the option is enabled which I verified with:

2024-05-16 17_31_47-Avans Hogeschool - Hbo-opleidingen

However the pk_vid parameter will just not be applied. The links are regular links and not loaded through any AJAX type of loading. What is the best way to debug this or make this work? I can send the manually but rather save the extra logic.



Hi @PiwikSander,

Just to be sure, you want to link two domains (like and, or two subdomains (like and

If we are talking about two domains:
It looks like you didn’t add all domains in your setup. enableCrossDomainLinking would work if you add all linked domains to the tracking setup.
Since it seems you have a hybrid setup, you would need to setup the linked sites to the tracker config in your tag manager as well.

If you would use the Piwik PRO installation script, this would be done automatically, in your case you have to maintain the changes in both environments.

Does this help?

Hi Richard,

Thanks for looking into it and your help.

To confirm: yes, two domains and not two subdomains. We have indeed a hybrid setup through GTM, for thought out reasons. In this case I’d need to run the setDomains method in the tag manager? (API — Piwik PRO Analytics Suite 18.17 documentation)

Btw: I am using this template as it offers more options for sending events, e-commerce etc.GitHub - mbaersch/piwikpro-template-for-gtm: Piwik PRO Analytics template for Google Tag Manager

Hi @PiwikSander,

I had to validate the setup.

In the template you need to add all domains that are tracked to the same site or app:

Like so:

This way the tracker would add the the two domains, so it knows about the domains to do the crossdomainlinking

Then there is something else.
The code that is output results in something like this:
because it will create the following code:

_paq.push(['setDomains', ['', '']]);

where it would need to set:

_paq.push(['setDomains', ['', '']]);

That would require a change in the template :slight_smile:

As a workaround (until the change is available) you can add a custom HTML template (it should be executed right after the main tracking template):

var _paq = _paq || [];
_paq.push(['setDomains', ['', '']]);

Let me know if that would work for you. It is always a bit tricky those hybrid solutions …

Kind regards,