Tracking Multiple Sites in a Roll-Up Property Using addTracker Functionality

I am looking for a way to track 3 different sites in a roll up property without using the meta site functionality:

There are a couple of reasons for this setup:

  1. A meta site is not optimal because we want to track complete user journey across site B, C D

  2. Access to data for these sites will differ across the client’s organization, as some teams should only have access to specific data relevant to their roles.

  3. It is important for the client to view data independently without segmentation within the same reporting modules under the same site in Piwik PRO.

From my understanding, implementing multiple tag manager containers is not feasible; however, it is possible to send data to multiple site IDs using the addTracker functionality. Tracking will be configured within the respective tag managers of Sites B, C, and D.

The plan is as follows:
On each site - B, C, and D - an adjusted container script will be implemented to ensure data is sent to both the relevant site and the roll-up property. This will allow data to be viewed and analyzed individually, as well as in the roll-up property for a complete user journey. The site ID in the addTracker part of the code will send data to the roll-up property.

Or would it make more sense to let roll-up be the “main” site ID to enable tracking across domain/ subdomain and let addTracker IDs be the ID of the 3 sites?

I would greatly appreciate an extra set of eyes on the adjusted container code to verify its accuracy:

After

.slice.call(arguments,1)})}}(i[c])}(window,“ppms”,[“tm”,“cm”]);

code line in container script, I will adjust as follows:

tags.onload = function() {
window._paq = window._paq || ;
window._paq.push(‘setTrackerUrl’, ‘[https://mysite.piwik.pro/ppms.php’]);
window._paq.push([‘setSiteId’, ‘23bbb672-8e9d-41d1-9452-c3905b645a07’]);
window._paq.push([‘addTracker’, ‘https://mysite.piwik.pro/ppms.php’, ‘ff3b9d5d-3241-49f4-9e7d-b0d997d46b34’]);
};
})(window, document, ‘dataLayer’, ‘23bbb672-8e9d-41d1-9452-c3905b645a07’);

Full script:

Could you please confirm if this code is correct for the desired tracking setup?

I look forward to your input.

Thanks in advance.

Best regards,
Kristian

Hi @Kristian_Kvistgaard,

Yes, this is the correct approach.
Generally if you want to have seperate tag manager configuration across the websites, going with seperate properties and adding the additional tracker to Site A would be the way to go.

I see that you’ve added the tracker url, site id and the new tracker in our container code. These settings are generally added in the Piwik PRO tag -


You can either make a custom Piwik PRO tag and add the addTracker method into it or just simply add a new tag with the addTracker method and just make sure its fired as one of the first tags.

The setTrackerUrl and setSiteId is already set in the Piwik PRO tag so no need to set it once again.

Hi Kamilb,

Thank you for the response and guidance.

I see I got container scripts/ Piwik Pro (basic) tag confused.

Here’s the approach I’m considering after your input:

  1. Separate Piwik PRO Containers for Each Site:
    Implement individual Piwik PRO containers on each site (B, C, and D) to collect data specific to each domain/subdomain.

  2. Additional Tracker for Roll-Up Property:
    In each site’s Tag Manager, create a custom tag that utilizes the addTracker function to send data to the roll-up property (Site A).

  3. Ensure this custom tag is configured to fire immediately after the primary Piwik PRO tag to establish the additional tracker promptly.The addTracker code snippet would be:

window._paq = window._paq || ;
window._paq.push([‘addTracker’, ‘https://mysite.piwik.pro/ppms.php’, ‘ff3b9d5d-3241-49f4-9e7d-b0d997d46b34’]);

'ff3b9d5d-3241-49f4-9e7d-b0d997d46b34 = roll-up site ID

  1. Subdomain Tracking Configuration:
    a) Enter domain/subdomain under Basic info on all sites

b) Within each site’s Piwik PRO tag settings, enable the "Recognize a visitor across subdomains option, that is:

Specify the main domain (e.g., *.mysite.dk) to ensure visitors are identified consistently across subdomains. Set cookie to *.mysite.dk

Questions:

  1. Will the addTracker function inherit the general settings from the primary Piwik PRO tag from the different sites?

  2. Could you please confirm if this approach aligns with best practices for implementing subdomain tracking using the addTracker method in Piwik PRO - so I get the “Complete User Journey” in the roll-up property (which is very important to the client?

Thanks a lot - in advance.

Best regards,

Kristian

Hi Kristian,

  1. No, the addTracker just adds an additional tracker to the already existing one and basically sends the exact same events to a different place.
  2. Yes, this is usually how we do it if there is a need for restricting access to specific websites data while at the same time having the option to see the whole user journey between websites.

Overall I can see that you got the idea, once you implement it you can double check it in the Network tab -

Also, since by default PageView is sent with the Piwik PRO tag it might be a good idea to send it after you add the new tracker. (this is why sometimes we make a custom Piwik PRO tag instead)

You can also just turn off the pageview in the Piwik PRO tag and create a new virtual pageview tag.

Have a great day! :slight_smile: