Multiple subdomain automated tracking

Hello,

I’m trying to figure out what’s the best way to track subdomains. We have a website - xxx[dot]com where we allow users to register an account so the subdomain is created, let say yyy.xxx.com. Piwik tracking code is added automatically to the header of the index page for that subdomain.

How can I set up piwik, so I would be able to see the list of subdomain names and how many visits they had?

I’m looking for something like this:

yyy xxx com - had 6 visits
zzz xxx com - had 4 visits
aaa xxx com - had 3 visits and so on.

Please note, that the process is fully automated and I can’t add different piwik tracking codes to each subdomain name because we can have 1000 of users registering a day… not scalable.

Any ideas?

Hi,

This help page mentiones the following:

If you track many subdomains in the same Piwik website, you might want to see the domain name directly in your Page Title reports. If you want to show support.example.org/Homepage instead of simply Homepage, check out the JS setDocumentTitle documentation.

You can change the name of a tracked page in piwik via javascript. E.g:

_paq.push(['setDocumentTitle', document.domain + "/" + document.title]);

Does this help you?

Thank you for your reply.

My script is already set up that wait. I’m possibly not sure on how to have a right view on piwik then…

var _paq = _paq || [];
/* tracker methods like “setCustomDimension” should be called before “trackPageView” /
_paq.push([“setDocumentTitle”, document.domain + “/” + document.title]);
_paq.push([“setCookieDomain”, "
.xxx"]);
_paq.push([“setDomains”, ["*.xxx"]]);
_paq.push([‘trackPageView’]);
_paq.push([‘enableLinkTracking’]);
(function() {
var u="//xxx.innocraft.cloud/";
_paq.push([‘setTrackerUrl’, u+‘piwik.php’]);
_paq.push([‘setSiteId’, ‘2’]);
var d=document, g=d.createElement(‘script’), s=d.getElementsByTagName(‘script’)[0];
g.type=‘text/javascript’; g.async=true; g.defer=true; g.src=u+‘piwik.js’; s.parentNode.insertBefore(g,s);
})();

This is a view I get:

Am I in the wrong place? :))) Should I be checking page titles? :smiley:

Hi, I haven’t used this feature before, so I’m no expert.
But I think you can see the data in the Page Title tab.

1 Like

Thanks a lot for all of your help!