• Resolved claytondaley

    (@claytondaley)


    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.

    https://www.ads-software.com/plugins/wp-piwik/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author braekling

    (@braekling)

    Oh, sorry, I didn’t realize the API parameter to add the wildcard.

    I’ll change this.

    Plugin Author braekling

    (@braekling)

    Done in 0.9.9.11.

    Thread Starter claytondaley

    (@claytondaley)

    Thanks for working on this. When I use the Tracking section in Piwik Settings, tracking across subdomains adds a line like:

    _paq.push([“setCookieDomain”, “*.purelyjuicers.com”]);

    In the wp-piwik plugin, it adds a line like:

    _paq.push([“setDomains”, [“*.claytondaley.com”,”*.daleyklippings.claytondaley.com”]]);

    It’s been a while so I’m rusty, but I pulled my Pull request back up and I think you want to use “mergeSubdomains” instead of “mergeAliasUrls” when making the API call.

    Plugin Author braekling

    (@braekling)

    Ok, I’m really sorry. I will check this again.

    Thread Starter claytondaley

    (@claytondaley)

    No need to appologize. I support an open source project (daleyklippings.claytondaley.com) so I appreciate (more than most) the time you invest and am happy to help if I can.

    Plugin Author braekling

    (@braekling)

    Fixed in 0.9.9.12, added both options (merge sudomains & merge alias urls).

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Track Across Subdomains (WP on Subdomain)’ is closed to new replies.