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

New visit not created after logout #15293

Closed
chetanakki opened this issue Dec 19, 2019 · 5 comments · Fixed by matomo-org/developer-documentation#320
Closed

New visit not created after logout #15293

chetanakki opened this issue Dec 19, 2019 · 5 comments · Fixed by matomo-org/developer-documentation#320
Labels
c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base.
Milestone

Comments

@chetanakki
Copy link

FYI, In our application we are using UserId feature.

I am setting below attributes when user clicks on logout button in our Application.
_paq.push(['resetUserId']);
_paq.push(['trackPageView']);

But, when the user logs back new visit is not created for the user with same UserId.

Please let me know, what is wrong here?

@tsteur
Copy link
Member

tsteur commented Dec 19, 2019

Since Matomo 3.12 or 3.13 a reset or login of the userId no longer creates a new visit since it is technically not a new visit.

You may be able to create new visit by calling this:

_paq.push(['appendToTrackingUrl', 'new_visit=1']); // (1) forces a new visit 
_paq.push(["deleteCookies"]); // (2) deletes existing tracking cookies to start the new visit
// the two lines must be above the call to track* function
_paq.push(["trackPageView"]);

@chetanakki
Copy link
Author

Thanks for the quick reply.
Please do update document here : https://developer.matomo.org/guides/tracking-javascript-guide#user-id

@tsteur
Copy link
Member

tsteur commented Dec 20, 2019

Created a PR 👍

@chetanakki
Copy link
Author

Thanks!.
I need one more information from you.
Suppose user is under a particular 'Menu' in our website, how to track what actions he is performing under that particular menu?.

@tsteur
Copy link
Member

tsteur commented Dec 23, 2019

I suppose you want event tracking maybe? https://matomo.org/docs/event-tracking/ Hard to say would need to know more. Best to ask these question in our forum: https://forum.matomo.org/

@mattab mattab added this to the 3.13.2 milestone Jan 21, 2020
@mattab mattab added the c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base. label Jan 21, 2020
mattab added a commit to matomo-org/developer-documentation that referenced this issue Jan 22, 2020
* Update docs since resetUserId no longer creates new visit

fix matomo-org/matomo#15293

cc @mattab can you have a look?

* we also force a new visit to be created for the pageviews after logout

* we make sure to not again create a new visit afterwards (important for Single Page Applications)

Got the idea from matomo-org/matomo#14739 (comment)

Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants