Hello, this is my situation:
domain www.a.it and domain www.b.it hosted by the same server
www.a.it/piwik and www.b.it/piwik pointing to the same piwik instance
If I login to www.a.it/piwik and, in the preferences, set the cookie to ignore my visits, my visits to www.b.it are not ignored.
If I login to www.b.it/piwik, I find that indeed the cookie is not reported as set. If I set it there, I finally get that my visits to www.b.it are ignored.
Now, as a matter of principle this wouldn't be a terrible issue. However, the GUI for setting the cookie explicitly says "will exclude your visits on websites tracked by Piwik", so I guess there's some problem.
Please feel free to ask me for specific informations (or to blame me for having missed something trivial).
Well, some information that I should provide without being asked: running piwik 0.6.1.
Your case is somewhat unusual with piwik running under two different domains. In fact if you set the cookie on a.it/piwik only websites that have a.it in their tracking code are excluded from the statistics.
Basically a cookie is bound to the domain that created it (a.it) and will only be sent by your browser if you visit a page on the same domain (a.it). This is the reason the same Piwik instance doesn't know about your cookie when you visit it using b.it.
Halfdan's right. This is an intentional browser limitation to prevent cross-domain cookie hijacking.
I imagined it, and that's perfectly fine. But all the piwik management interface is absolutely general in terms of number and address and websites tracked, so add to it that the link to set the cookie says
" Click here to set a cookie that will exclude your visits on websites tracked by Piwik "
and you understand that it is very misleading. Please explain, near that link, what you just wrote to me, change the link text to "click here to set a cookie that will exclude your visits on currentdomain.it and subpages", and that's fine.
Notice that my case of piwik running under two domains may be unusual, but the case of tracking two different domains is certainly not, and the same problem applies (err, no, it's worse... but then, it's not your fault).
did you use DNS aliases to have both domains under the same piwik?
I would think that anybody using DNS aliases would understand how cookies work, but again I agree the message could be improved. reopening
I personally have no idea of what a DNS alias is.
To have both domains under the same piwik, I started, as suggested on the piwik forums (sorry, at the moment can't find where) with a bare symlink to a single piwik instance from two root directories of two different apache2 virtual servers. I'm sure people that play with apache configuration outnumber people who play with advanced DNS settings.
Then, I lately switched to using something like
Alias /piwik "/path/to/piwik/"
Options Indexes MultiViews FollowSymLinks
allow from all
in the apache2 configuration for each site (I did that for cleanness, but also because apparently - didn't investigate really a lot - if the real piwik install was reached through a symlink pointing to a symlink, then the web interface missed any image, css and so on - if you're interested in that, I can try to replicate and file a separate bug).
My main problem is that I want to access statistics for different sites via the same administrative interface, but those are unrelated sites, so I don't want visitors of site b.it to see that they're connecting (or see in the html an address) to site a.it (btw, that's exactly the reason why I'm migrating away from Google Analytics).
Piwik is great at that, except where it can't, like in this case: and I think just stating it can't solves the problem.
Then, the perfection would be that the administrative interface does the following:
I open it through a.it/piwik
it knows that b.it is tracked through b.it/piwik, so tells me "hey, click here, but know that this particular ignore cookie will only affect site tracked through a.it/piwik"
and does so for any other ./piwik that it has detected
But that introduces a non trivial layer of abstraction that I'm not sure piwik is interested in (and my php skills and time availability are not big enough...).
I'm not even sure if we can tackle this as part of the first-party cookie implementation in #557.
Suppose we have a site with 2 sites being tracked, with the following URLs:
Let's also say the Piwik tracker can be accessed as a folder in any of the above, e.g., www.site1.com/piwik, www.site1.net/piwik, mydomain.com/site1/piwik, etc.
And just to make it interesting, let's say I access my master Piwik installation via mystats.com.
But feel free to skip the details if you really think it's unfeasible, I don't want to loose your time.
site1.com/piwik/x.js, site2.com/stats/x.js, mystats.com/x.js
Perhaps we can implement this using image requests (like the web bug image).
(In ) quick fixes #1376 - add cookie domain to link text, i.e.,
Click here to set a cookie that will exclude your visits on websites tracked by Piwik on MYSITE.TLD
My point was precisely that the piwik install itself would bear the task of remembering from where it is accessed, the user should at most ensure that one visit is done before trying to set the cookie.
But again, the implemented solution is perfectly accettable, thanks.