Piwik on Multiple Domains, Multiple Servers - How To

Hi, I run a network of websites and am loving Piwik.

Right now, EVERY site has domain.com/piwikstats but this is very cumbersome to go to each one and look at stats. I need a master panel for ALL of them so I only need to log into to one location.

I’ve read General - Analytics Platform - Matomo but I’m still not sure how to go about architecting this.

  • Do you still install /piwikstats on EACH site?
    – But then you tell it to connect to a remote database on the master server (which needs to accept remote connections)?

  • Or does each webserver still host its own database, and then the remote panel from the master server finds a way to access it remotely?

  • Or do you not install /piwikstats at all on the master server, but instead add some javascript to tell it to contact the main server to store data?

I’d prefer not to lose my existing data, and don’t want to leave any suspicious footprints where Google can see the entire network is all tracking into one host (this is why I’m staying away from Analytics).


Or do you not install /piwikstats at all on the master server, but instead add some javascript to tell it to contact the main server to store data?
That is the way to do it. HOwever you will lose your data because there is no way to move data between piwik servers yet.

Excellent, thanks.

Since these are all Wordpress sites and using WP-Piwik, I can take a look at that plugin’s code to do so. I’m willing to “lose” some of that data to start over properly… better late than never I suppose. I can always cobble it together if someone wants to buy the domain or something.

My concern now is that all of these sites will have a similar footprint. Doubt Google is that sharp, but I don’t want them knowing that I own all of these sites around the country (they are quality sites, but they are also all providing link juice to a master site of mine). Oh well, that’s my SEO problem.


There is now a workaround for the “same footprint / piwik URL” in the source code. Check out: Document how to hide piwik server URL in the Javascript · Issue #2019 · matomo-org/matomo · GitHub

and please post your comment in this ticket directly, I would like to turn it into an official documentation but need more feedback

Hey Thanks - I’m now tracking from a master server.

post edited - I misunderstood something.

Trying to hack wp-piwik to do this.

OK, so far this isn’t working. It DID work remotely before changing this up.

My site is this Colostrum website. The footer has the Piwik call.

  • This site is site #2 so I changed that part of the code
  • I am using your piwik.php file locally on colostrummilk.com, but the server is now at Piwik 1.3, which came out after your post. Does that matter?
  • By default, WP-Piwik uses the call

self::$arySettings['tracking_code'] = html_entity_decode($this->call_API('SitesManager.getJavascriptTag'));

which seems to come from the main server. If you’re going to make this a part of Piwik, you’ll want the getJavascriptTag function to output the proper “hidden” code.

I had to hardcode this into the plugin, which will get overwritten if I ever update WP-Piwik.

Finally, another thing that’d be nice is support for noscript image tracking. WP-Piwik likes to do this:

<noscript><p><img src=\"http://www.colostrummilk.com/piwik.php?idsite=2\" style=\"border:0\" alt=\"\" /></p></noscript>

Which doesn’t work with this.

Anyway, any ideas on what I’m doing wrong? My code seems to be fine.


I think you have also overwritten the piwik.php in your E…F.T website, but you shouldn’t overwrite it there, because this is your piwik server. am I right?

Oh you’re right - confused FTPs there - thanks! This works great now. Would love to see it fully integrated. Piwik has become some killer software.

This is actually can be done like we did (we have network of websites too) but this depends on your servers setup as we have SAN attached on our servers.

to give you an idea we only have one piwik installation but if I go to any of our website i can access them either login as superadmin or the standard user.



This is all great information but I would really like to know how to go about setting this up, I am a complete newbie to Piwik but really like the look and feel and would like to use it myself.


Good news: GeoIP is now integrated in Piwik, enabling Accurate Visitors Geolocation in your Analytics reports. To enable GeoIP go to the Settings > Geolocation admin page, and follow the short instructions.

You can also get an even more accurate Country & City Database from here to enjoy top accuracy in detecting your visitors locations.

See also the documentation about Geolocation - Analytics Reports in Piwik.

I have two domains in a same server both sites are dynamic http://www.primekhobor.com
Now can anyone tell me hoy piwink can help me to get better result in search engine??