Hey @ravisingh and @halfdan:
This discussion was from a few years ago. Was a solution ever found for this?
What I want:
I want to be able to use one install on a subdomain like piwik.mydomain.com but be able to have multiple databases with different client and personal sites in each.
Why I want this:
I want to be able to log into PIWIK and just see sites of a certain type. I realize I could create different user login and then just give them access to these sites so they are the only ones that show up and that would be one organizational solution. But I also have this idea that multiple databases would provide some extra security and redundancy in case something happens to one database or one site explodes in traffic it doesn’t bring down everything. Keeping one code deployment instead of installing multiple code deployments would, as @halfdan mentioned, cut down on updating time.
My idea on a solution:
Let’s say I have the following three groupings of sites and I want to create three databases for each but use one code deployment. I would basically have to add a variable to the tracking code or some other unique identifier and then each time the tracking snippet is called it would catch this variables like “&sitegroup=2” and choose the right database for this sitegroup. Alternatively, you could create special subdomains for each subgrouping like personalsites.piwik.mydomain.com and clientsites1.piwik.mydomain.com and then write some code that would look for these urls and assign the proper database depending on the server request URL in the tracking code. RIght? I just tested the creation of these subdomains and then updating my tracking code with the subdomains and it looks like visits are still being counted so as long as I could write the code to detect the request server and direct each request to the proper database based on the domain then this could work … I guess I worry about whether this would cause significant performance issues though. Or whether it’s possible at all.
Any other ideas on this?
Thanks for any feedback.