matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!

Home Page:https://matomo.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Being able to track a website in two separate instances (without duplicating tracking in one instance based on the other)

ffkpisfr opened this issue · comments

In some cases, websites have a Matomo tracking fired by one instance - let's call it instance A - owned for by a web agency for example.

But clients want to have their own tracking based on their Matomo instance (Instance B).

Today, if I install this tracking, the data is mixed because _paq object is the same for instance A and instance B.

How can we solve this issue without relying on :

/ Add this code below within the Matomo JavaScript tracker code
// Important: the tracker url includes the /matomo.php
var secondaryTrackerUrl = 'https://analytics.example.com/matomo.php';
var secondaryWebsiteId = 77;
// Also send all of the tracking data to this other Matomo server, in website ID 77
_paq.push(['addTracker', secondaryTrackerUrl, secondaryWebsiteId]);

Because this implies that we will depend on somebody else's tagging plan, tracking config, etc.

Thank you.

Frederic