Track Across Subdomains (WP on Subdomain)
-
I forked a previous version of WP-Piwik to track users across subdomains (in concert with API upgrades that are now publicly available). Now that the feature is included in core, I was hoping to use that version.
My issue is that my WP instance is already on a subdomain… and what I actually want to do is track users across subdomains of my parent domain. With the API (and thus my fork) this is possible. Specifically, you configure the URLs on your domain as follows:
domain.com
subdomain.domain.com… then the API call will attach “*.” to the first domain in the list (the parent domain). It’s a bit of a hack, but it’s exactly the same logic used to populate the “Tracking Code” section of Piwik’s settings.
For some reason, the core version of wp-piwik behaves differently. Every time I upgrade (and I’ve gone back-and-forth to verify), the SetCookiesDomain gets set to *.subdomain.domain.com.
If (and I’m just guessing) this occurs because you’re (internally to wp-piwik) adding the *. to the full WP domain, it could be fixed with a simple toggle “WP is on a subdomain” that knows to exclude the subdomain from the SetCookiesDomain.
- The topic ‘Track Across Subdomains (WP on Subdomain)’ is closed to new replies.