Piwik – Single install for multiple domains
- June 27th, 2009
- Posted in Featured . Tutorials
- Write comment or click if you like the post:

There are a couple of benefits for running a single Piwik installation for multiple domains such as a single database, single install and easy tracking from a single control panel. We can also expect more accurate results because many people such as myself use NoScript and have it set up to automatically allow top level sites by default.
As more browsers start to wise up to XSS problems, we’ll all eventually have problems with external JS and by having our own analytics we stay a step ahead. The benefits of using your own tracking software rather than relying on the big G’s or others are obvious, but if you’d like to know more, be sure to check out Piwik’s site: http://piwik.org/
Now to the good stuff. It’s really an easy process, and this is just one of many ways you can do it:
Download and install Piwik to a folder outside your publicly accessible space.
Create symbolic links to each of your domains folders:
cd domain1/ ln -s ../piwik/ track cd ../domain2/ ln -s ../piwik/ track cd ../domain3/ ln -s ../piwik/ track
etc…
Add meta nofollow tags to the templates:
<meta NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW" />plugins/Login/templates
plugins/CoreHome/templates
And add it to piwik/robots.txt if you want:
#Disallow everything
User-agent: *
Disallow: /
Disallow: /*
Disallow: */*
Disallow: *.*
Disallow: *
Disallow: .
Next you can log in to your Piwik install from any of your domains like this:
http://domain1.com/track/
Then you can add your site and it will create tracking code for the domain your are logged in from.
You can manage and view your data for any domain from any other domain since its a single installation.
Are you assuming all the domains are under one hosting account? What if they are on multiple hosts? Is there a way to display mutiple sites’ traffic in Piwik if the sites are one different hosts?