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

By default userId should overwrite the visitorId #16124

Merged
merged 14 commits into from Jul 8, 2020
Merged

By default userId should overwrite the visitorId #16124

merged 14 commits into from Jul 8, 2020

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Jun 26, 2020

refs #15593

This PR is basically reverting https://github.com/matomo-org/matomo/pull/14360/files but having an option to basically still use that behaviour.

Once merged will need to document this behaviour.

The failing UI test https://builds-artifacts.matomo.org/matomo-org/matomo/4.x-dev/41350/UIIntegrationTest_widgetize_ecommercelog.png seems not related to this PR

@tsteur tsteur added Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Jun 26, 2020
@tsteur tsteur added this to the 4.0.0 milestone Jun 26, 2020
; When enabled and a userId is set, then the visitorId will be automatically set based on the userId. This allows to
; identify the same user as the same visitor across devices. It might also create a new visit as soon as a user logs in
; or logs out. This won't be the case when this feature is disabled and it separates the userId from the visitorId.
; Disabling this feature can be useful for example when using the third party cookie, and thus all Matomo sites use
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really sure how to best explain when it would be useful. it's a quite specific case I guess

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its well explained 👍

@@ -189,7 +190,8 @@ public function isVisitNew(VisitProperties $visitProperties, Request $request, $
return true;
}

if (!$this->lastUserIdWasSetAndDoesMatch($visitProperties, $request)) {
if (!TrackerConfig::getConfigValue('enable_userid_overwrites_visitorid')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this could also be a separate setting? Or not sure if that makes sense or not

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I would keep it simple and leave it like that.

@MichaelRoosz
Copy link
Contributor

@tsteur Thank you for your work 👍 Looks good in my opinion.

@tsteur
Copy link
Member Author

tsteur commented Jun 28, 2020

@peterbo could you maybe also have a quick look if that would work for you?

@peterbo
Copy link
Contributor

peterbo commented Jun 29, 2020

@tsteur Code looks good to me. I'll test it later today in production to make sure! :) Ty!

@tsteur tsteur added Needs Review PRs that need a code review and removed Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. labels Jun 30, 2020
; When enabled and a userId is set, then the visitorId will be automatically set based on the userId. This allows to
; identify the same user as the same visitor across devices.
; Disabling this feature can be useful for example when using the third party cookie, and thus all Matomo sites use
; the same "global" visitorId for the same device, and some Matomo sites set a userid.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would change 'and thus all Matomo sites use the same "global" visitorId for the same device, and some Matomo sites set a userid.' to 'where all Matomo tracked sites use the same "global" visitorId for a device and you want to see when the same user switches between devices.'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated 👍

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm noticing these test results are exactly the same as the normal testApi() tests. I think the Fixture needs to be changed, tracking the same visits w/ the new setting set. Maybe into a new site, then running API tests for the new site.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 not sure what I was thinking @diosmosis . I've created a new fixture and new tests that test this behaviour now properly

@diosmosis diosmosis merged commit b055373 into 4.x-dev Jul 8, 2020
@diosmosis diosmosis deleted the m15593 branch July 8, 2020 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants