# Pk\_vid parameter not appended where GA parameters are

**URL:** <https://community.piwik.pro/t/pk-vid-parameter-not-appended-where-ga-parameters-are/4018>\
**Category:** Data collection and tags\
**Created:** [May 16, 2024, 3:35pm UTC](https://community.piwik.pro/t/pk-vid-parameter-not-appended-where-ga-parameters-are/4018 "2024-05-16T15:35:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![PiwikSander](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@PiwikSander](https://community.piwik.pro/u/PiwikSander)\
**Post date:** [May 16, 2024, 3:35pm UTC](https://community.piwik.pro/t/pk-vid-parameter-not-appended-where-ga-parameters-are/4018/1 "2024-05-16T15:35:31Z")

</div>

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](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/f/f9ebdea12b7281760eb27272c3d0c7401aa66258.png)

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

---

<div class="post-metadata">

**Author:** ![rmastop](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/rmastop/32/29_2.png) [@rmastop](https://community.piwik.pro/u/rmastop)\
**Post date:** [May 16, 2024, 3:55pm UTC](https://community.piwik.pro/t/pk-vid-parameter-not-appended-where-ga-parameters-are/4018/2 "2024-05-16T15:55:00Z")

</div>

Hi @PiwikSander,

Just to be sure, you want to link two domains (like [examplesite1.com](http://examplesite1.com) and [examplesite2.com](http://examplesite2.com)), or two subdomains (like [site1.example.com](http://site1.example.com) and [site2.example.com](http://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

---

<div class="post-metadata">

**Author:** ![PiwikSander](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@PiwikSander](https://community.piwik.pro/u/PiwikSander)\
**Post date:** [May 17, 2024, 7:16am UTC](https://community.piwik.pro/t/pk-vid-parameter-not-appended-where-ga-parameters-are/4018/3 "2024-05-17T07:16:20Z")

</div>

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](https://developers.piwik.pro/en/latest/data_collection/web/javascript_tracking_client/api.html#jtc-api-setdomains))

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](https://github.com/mbaersch/piwikpro-template-for-gtm)

---

<div class="post-metadata">

**Author:** ![rmastop](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/rmastop/32/29_2.png) [@rmastop](https://community.piwik.pro/u/rmastop)\
**Post date:** [May 17, 2024, 2:29pm UTC](https://community.piwik.pro/t/pk-vid-parameter-not-appended-where-ga-parameters-are/4018/4 "2024-05-17T14:29:54Z")

</div>

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](https://europe1.discourse-cdn.com/flex005/uploads/piwikpro/original/2X/1/101c0472833cbc264f620d964bc750d365d04564.png)

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:

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

```

where it would need to set:

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

```

That would require a change in the template 🙂

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

```auto
<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

---

<div class="post-metadata">

**Author:** ![PiwikSander](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@PiwikSander](https://community.piwik.pro/u/PiwikSander)\
**Post date:** [May 21, 2024, 6:28am UTC](https://community.piwik.pro/t/pk-vid-parameter-not-appended-where-ga-parameters-are/4018/5 "2024-05-21T06:28:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PiwikSander](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@PiwikSander](https://community.piwik.pro/u/PiwikSander)\
**Post date:** [May 21, 2024, 6:43am UTC](https://community.piwik.pro/t/pk-vid-parameter-not-appended-where-ga-parameters-are/4018/6 "2024-05-21T06:43:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rmastop](https://dub1.discourse-cdn.com/flex005/user_avatar/community.piwik.pro/rmastop/32/29_2.png) [@rmastop](https://community.piwik.pro/u/rmastop)\
**Post date:** [May 22, 2024, 9:20am UTC](https://community.piwik.pro/t/pk-vid-parameter-not-appended-where-ga-parameters-are/4018/7 "2024-05-22T09:20:12Z")

</div>

perfect, thanks for confirming.
