Two tracking IDs at once?


I have three domains - e.g.,, and I want to track each one separately, but also have a unified account showing data from all three.

So far, I have a standard tracking code on each domain, working properly, as follows:

    <script type="text/javascript">
      var _paq = _paq || [];

      (function() {
        var u=(("https:" == document.location.protocol) ? "https" : "http") + "://";
        _paq.push(["setTrackerUrl", u+"piwik.php"]);
        _paq.push(["setSiteId", "1"]); // With 1 being '', for example
        var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
        g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);

What do I need to add so that I can track two sites (i.e. the specific site, and the aggregated site) at once? I tried adding something like:

      var _paq_all = _paq_all || [];

and inside the function…

        _paq_all.push(["setTrackerUrl", u+"piwik.php"]);
        _paq_all.push(["setSiteId", "5"]); // With 5 being 'all domains', for example

… but this didn’t seem to work. Any tips much appreciated!




You should use SYNC version (not async)