Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

piwik.js: bridge third-party to first-party cookies #2394

Closed
robocoder opened this issue May 4, 2011 · 3 comments
Closed

piwik.js: bridge third-party to first-party cookies #2394

robocoder opened this issue May 4, 2011 · 3 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Milestone

Comments

@robocoder
Copy link
Contributor

See http://forum.piwik.org/read.php?3,76449

Basically, there would be a method that could be called to read the (third-party) piwik_visitor cookie, and set the visitorUUID in piwik.js

Pseudo-code:

function setVisitorIdFromServerCookie( cookieName = 'piwik_cookie' ) {
    var id = getCookie(getCookieName('id'));
    // only if the first party cookie doesn't already exist
    if(!id) {
        id = getCookie( cookieName );
        // only if the server cookie exists
        if(id) {
            // (oversimplified...in reality, you have to strip the signature first)
            visitorUUID = id;
        }
    }
}

Alternately, we add a method that allows the server cookie name to be defined, and piwik.js automatically recognizes it in loadVisitorIdCookie(), e.g.,

    ...
    piwikTracker.setServerCookieName('piwik_visitor');
    piwikTracker.trackPageView();
@mattab
Copy link
Member

mattab commented May 4, 2011

How will you read the 3rd party cookie in JS? the only way I can think of is with jsonp but that's a massive overhead (2 requests instead of 1)

@anonymous-matomo-user
Copy link

I might not quite understand how this works, but if the user's browser blocks 3rd party cookies, this wouldn't be able to join two visits. Right?

@robocoder
Copy link
Contributor Author

right. if third party cookies are blocked, this idea won't work.

it assumes the third party cookie is available when the piwik.js resource is loaded from the same domain as the image tracker.

feel free to consider a server-side solution that overcomes these limitations.

@robocoder robocoder added this to the 1.x - Piwik 1.x milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

3 participants