Multiple websites on same server


#1

I have 3 websites, all on the same shared server. One of the sites has an SSL, the others do not. So do I need to install Piwik seperately for each website, or do I install it once to track all 3 sites?
If just one install, should I install it at the top of my publichtml directory, or inside a seperate directory?
Do I use the same tracking code on all 3 sites, or generate seperate codes for each?


#2

linuxpcplus,

You could run a single Piwik instance, for example, as a subdomain of your SSL site i.e. https://analytics.mysecuresite.com

From there add websites and generate unique tracking codes for each. The SSL site should use protocol relative tracking code - like: //analytics.mysecuresite.com/piwik.php

In that scenario you’d also benefit from using “force_ssl = 1” in config.php. There really isn’t much benefit to having multiple instances of Piwik usually, because each will need databases and drain your server’s resources. The only real use case I can imagine is where you have 2 websites each in different countries with different applicable privacy laws (IP anonymization, cookies, etc) - even then I’m not sure how ‘legal’ that is.

I personally already run a main website over SSL-only (HSTS, actually), piwik on a subdomain of that, and various other static/dynamic http sites.

For the main structure it’s like:

/home/myuser/public_html <-- contains just the website
/home/myuser/public_html/piwik <-- where piwik is placed

Or you can have Search, Register and Transfer Web Domain Names and More, but really unless you’re not using the domain for anything except Piwik, then you need a folder to contain it.

Rich


#3

Thank you for clearing that up Rich! I appreciate it!


#4

Can’t get tracking on 2 websites. I have:

mywebsite1.com/piwik (stats work fine here)
mywebsite2.com

2 domains being hosted on dreamhost under 1 hosting plan

I added mywebsite2 under settings-add websites (name - mywebsite2…url - mywebsite2.com)

Tracking code (generated from Piwik) is identical except setsiteid 3 and idsite=3 on last line.

Code for mywebsite1.com

Code for mywebsite2.com

What am I missing?
Thanks, Don