Multiple Domain Tracking?

(Serpetuity) #1

Sorry if this has been asked, I did not see anything in the FAQ, but can I add the same tracking code to multiple domains yet still get reporting broken down by domain?

This looks good - I am glad there is an alternative out there!

(Karlsson) #2

I´ve never tested this with the same code for different domains. But I assume, that you are getting crap.

Why don´t you use a different tracking code for each site?

(Serpetuity) #3

With GA, you can install the same tracking code on multiple domains and then view traffic reports by domain.

If you are generating a few landing pages per day, having 1 tracking code makes life a bit easier

(Serpetuity) #4

Looks like no one has responded to this - has anyone attempted this or is it even possible?

(vipsoft) #5


If you want to consolidate your stats, then use the samr tracking code for all your stats.

If you want to segment by site, the idsite has to be unique. (This is similar to uniqur account IDs in GA.)

You can have multiple instances of the tracker, and combine the above techniques.

(Burkhard) #6

I have been playing around with this … one test site and one production site. Similar to your requirement: I want identical code, but I don’t want tests counted in my production stats. I found three solutions that work:

  1. Use the same IDSITE number every time but differentiate test vs. prod using the “piwikTracker.setDocumentTitle();” feature.

  2. Use different IDSITE numbers for test and prod

  3. Do both

I do both. In any case, you would need to add some “If a am running from prod then IDSITE=X else IDSITE=Y” logic to the JS tag. Then you have the same tag code everywhere. That can maybe be adjusted to your purpose.


(vipsoft) #7

See the plugin in #2371 TrackSiteByUrl - automatically set idsite in tracking request based on current page's URL · Issue #2371 · matomo-org/matomo · GitHub


The API states otherwise, but I can’t get it to work.

[quote=“API Reference”]
[li] the integer id of your website, eg. idSite=1
[/li][li] you can also specify a list of idSites comma separated, eg. idSite=1,4,5,6
[/li][li] if you want to get data for all websites, set idSite=all

(vipsoft) #9

That’s for the REST API. You can’t use “all” or a comma separated list in the tracking API. (It might be nice if it did, but we haven’t scoped the effort/impact of doing this.)