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.

Thanks!

Sander

Hi @PiwikSander,

Just to be sure, you want to link two domains (like examplesite1.com and examplesite2.com), or two subdomains (like site1.example.com and site2.example.com)?

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?
Cheers,
Richard

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:
screenshot_3429

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', ['https://site1.example1.com/', 'https://site2.example2.com/']]);

where it would need to set:

_paq.push(['setDomains', ['site1.example1.com/', 'site2.example2.com/']]);

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):

<script>
var _paq = _paq || [];
_paq.push(['setDomains', ['site1.example1.com', 'site2.example2.com']]);
</script>

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

Kind regards,
Richard

Hi Richard,

Awesome help! I will try this right away. Makes a lot of sense. I will update if it resolved my issue.

Thanks!

Sander

Hey @rmastop,

And we have a winner. Never been so happy to see a url query string being added. ;-). I will make some adjustments to our template as it’s already customized and we’ll be migrating to PP Tag Manager on the short term so don’t need any upcoming updates to the template.

Thanks a lot!

Sander

perfect, thanks for confirming.