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

Update docs since resetUserId no longer creates new visit #320

Merged
merged 3 commits into from Jan 22, 2020
Merged

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Dec 20, 2019

fix matomo-org/matomo#15293

cc @mattab can you have a look?

@tsteur tsteur added this to the Current sprint milestone Dec 20, 2019
@tsteur tsteur requested a review from mattab December 20, 2019 22:19
@mattab
Copy link
Member

mattab commented Dec 24, 2019

The doc still says: // User has just logged out, we reset the User ID which also generates a new Visitor ID

Although the code is:


            /**
             * Clears the User ID and generates a new visitor id.
             */
            this.resetUserId = function() {
                configUserId = '';
            };

Can we change the comment to // User has just logged out, we reset the User ID which un-sets the User ID or so?

@mattab
Copy link
Member

mattab commented Dec 24, 2019

Or should we actually maybe rather reset the Visitor ID, when resetUserId is called, to indeed force a new visit to be created? This way we don't have to update https://matomo.org/faq/how-to/faq_187/ and break BC?

@tsteur
Copy link
Member Author

tsteur commented Dec 24, 2019

@mattab I don't think that's a good idea. It's like then you can as well undo the entire change. Also AFAIK we are not doing this when you set a userId so it's not quite consistent behaviour. It would be kind of taking control out of the user if we always created a new visit then maybe... could be done though... but then you'd also need to create a new visit when setting a userId etc.

@mattab
Copy link
Member

mattab commented Jan 21, 2020

@tsteur slightly tweaked to document how to force creating a new visit.
I'm now wondering, what is the point of calling resetUserId at all when users don't call the ['appendToTrackingUrl', 'new_visit=1'] method?

@mattab
Copy link
Member

mattab commented Jan 21, 2020

also added another commit after reading matomo-org/matomo#14739 (comment)

@mattab mattab requested a review from diosmosis January 21, 2020 07:25
@diosmosis
Copy link
Member

what is the point of calling resetUserId at all when users don't call the ['appendToTrackingUrl', 'new_visit=1'] method?

👍 i don't think that makes sense either. have to do both to associate the action with an entirely new context (w/o associating it w/ any userid).

@tsteur
Copy link
Member Author

tsteur commented Jan 21, 2020

what is the point of calling resetUserId at all when users don't call the ['appendToTrackingUrl', 'new_visit=1'] method?

The point is consistent behaviour. Currently, we are not creating a new visit when someone logs in. So it be inconsistent to create a new visit when the user logs out. See #320 (comment)

Behaviour should be either consistent where it creates a new visit on log in, and log out. Or not at all.

@diosmosis
Copy link
Member

The point is consistent behaviour. Currently, we are not creating a new visit when someone logs in.

But the docs here say we should create a new visit when logging someone out? Maybe I'm misreading the conversation on the ticket?

@tsteur
Copy link
Member Author

tsteur commented Jan 21, 2020

@diosmosis Yes. I was initially creating this doc to mention it no longer creates a visit as this is what is implemented. It could be changed though to create a new visit on log in and log out.

@mattab mattab merged commit 16808dc into master Jan 22, 2020
@mattab
Copy link
Member

mattab commented Jan 22, 2020

FYI: I've also changed the guide:

from:

Signing-out use case: In the case where a visitor visits your website and is logged-in (User ID is set) then a visit will be created for this User ID. If then visits logs out then the visitor has no User ID set any more and a new visit will be created on the page view right after logging out. (if User ID was not used then the requests would have been tracked into one visit and one unique visitor). Starting in Matomo 3.4.0 we introduce a new functionality to record a user logging out, via the method resetUserId, learn more about about When user logs out, reset User ID in the developer guide.

to:

Signing-out use case: In the case where a visitor visits your website and is logged-in (User ID is set) then a visit will be created for this User ID. If the user then logs out and has no User ID set any more (resetUserId function is called), a new visit will not be created for the page views after logging out. Subsequent pageviews will still be tracked in the existing visit, and this visit will still have the User ID set. You can also easily force a new visit to be created when users log out, learn more in the developer guide for JavaScript Tracking: when user logs out, reset User ID

@mattab mattab deleted the 15293 branch January 22, 2020 03:23
@mattab
Copy link
Member

mattab commented Jan 23, 2020

FYI also made another change to call deleteCookies in https://github.com/matomo-org/developer-documentation/pull/325/files which is now consistent with https://matomo.org/faq/how-to/faq_187/

@innocraft-automation innocraft-automation removed this from the Current sprint milestone Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New visit not created after logout
4 participants