Hello. I’m new to Piwik. I’m just installing it on our system (well, on staging first, before production) which hosts several hundred websites, all served via a WordPress Multisite via a load-balanced cluster on Amazon EC2. All the sites are ‘ours’, rather than belonging to our customers or anything like that.
Now, firstly, I see that the web-site list has to be created manually by adding sites one-by-one. While a bulk import feature would have been nice, I believe I’ll be able to automate creation of sites using the API - for example by calling SitesManager.addSite() on all our existing sites and adding a call to that in our new site creation code (which is admin-back-end for our IT team only).
However, it appears that the tracking code needs the siteId rather than the domain. Is that correct, or is there a way to supply the JS tracker with the domain name instead of siteId and have piwik look it up? or a way to have the JS tracker just obtain the domain from the DOM document?
If not, I’m guessing the other way to implement it would be for the server-side page rendering to make an API call to SitesManager.getAllSitesId() to obtain the siteId for a given request based on the HTTP HOST header and inject that into the tracking code in the response (- obviously, the ids will need to be cached for efficiency).
Is there another and/or better way? I don’t see any JS tracker functions to map a domain to the siteId.
If not, perhaps this could be a feature request? - to allow the JS tracker constructor to be passed a site main domain URL instead of siteId? (or even some way to have it obtain it from the DOM itself - such as passing -1 as the siteId?)
Apologies if I’ve missed something obvious or a common answer in the forums (I did search…) - since I’ve only just had contact with Piwik for a couple hours now…