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

Using setCookiesPath creates 2 cookies #8112

Closed
parruc opened this issue Jun 15, 2015 · 4 comments
Closed

Using setCookiesPath creates 2 cookies #8112

parruc opened this issue Jun 15, 2015 · 4 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@parruc
Copy link
Contributor

parruc commented Jun 15, 2015

I have some subdirs that I want to track as different sites. Following the docs I called, in the tracking code, setCookiesPath but two id cookies are created the first on / and the second on the right subdir.

I've debugged the js and the first cookie is created at constructor time

rows: 5340 and 5341

var applyFirst = ['disableCookies', 'setTrackerUrl', 'setAPIUrl', 'setUserId', 'setSiteId', 'enableLinkTracking'];
_paq = applyMethodsInOrder(_paq, applyFirst);

In particular setSiteId sets the id cookie too soon (before I can call setCookiesPath) my and I end up having 2 id cookies, one for the root and one for my selected subdir.

@mattab
Copy link
Member

mattab commented Jun 16, 2015

Hi @parruc

could you paste here your Piwik JavaScript Tracking code?

@parruc
Copy link
Contributor Author

parruc commented Jun 16, 2015

Here it is the tracking code I'm using @mattab:

<!-- Piwik -->
<script type="text/javascript">
     var paq = paq || [];
     _paq.push(['setCookiePath', '/people/john.doe']);
     _paq.push(['trackPageView']);
     _paq.push(['enableLinkTracking']);
    (function () {
        var u = "https://example.com/";
        _paq.push(['setTrackerUrl', u + 'piwik.php']);
        _paq.push(['setSiteId', 14302]);
        var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
        g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = u + 'piwik.js'; s.parentNode.insertBefore(g, s);
  })();
</script>
<noscript><p><img src="https://example.com/piwik.php?idsite=14302" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

@parruc
Copy link
Contributor Author

parruc commented Jun 26, 2015

Were you able to reproduce it @mattab ?

@mattab
Copy link
Member

mattab commented Jul 7, 2015

Fixed in #8265 @parruc if it's not fixed please re-open

@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Jul 7, 2015
@mattab mattab added this to the 2.14.0 milestone Jul 7, 2015
@mattab mattab closed this as completed Jul 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants