@AAudusseau opened this Issue on December 14th 2020

Hi everyone, I would like to track some events from the server side, and before Matomo I was unable to do it because of this issue : https://github.com/matomo-org/matomo/issues/15593

Now the problem is gone, but the behavior describe here is not true anymore. Visit when the user was not logged are not merged anymore after setting the user ID.

@tsteur commented on December 14th 2020 Member

Hi @AAudusseau

you can get the previous behaviour as it was under Matomo 3 by setting the following config in your config/config.ini.php:

[Tracker]
enable_userid_overwrites_visitorid = 0

I've also tweaked the guide slightly to mention this

@AAudusseau commented on December 15th 2020

Hi @tsteur,

Thanks for your answer. I saw this option, but unfortunately I use a cloud-hosted instance so I can't change the configuration myself and I suppose it is enabled by default. I think I need the Matomo 3 behavior and force the visitorId from the server side.

About your changes in the guide, the part "When a visitor connects to your website and is not logged-in (User ID is not set)" is still wrong when the option is enabled (this is the purpose of this issue).

And also I look a bit in the code, and there is duplicate code here : https://github.com/matomo-org/matomo/blob/4.x-dev/core/Tracker/Visit.php#L585, probably a merge mistake πŸ˜‰

@sgiehl commented on December 15th 2020 Member

And also I look a bit in the code, and there is duplicate code here : https://github.com/matomo-org/matomo/blob/4.x-dev/core/Tracker/Visit.php#L585, probably a merge mistake πŸ˜‰

Thanks for that hint. Will create a PR to change that πŸ‘

@tsteur commented on December 16th 2020 Member

I use a cloud-hosted instance so I can't change the configuration myself and I suppose it is enabled by default.

Just FYI if you're using Matomo Cloud then we can change this for you.

About your changes in the guide, the part "When a visitor connects to your website and is not logged-in (User ID is not set)" is still wrong when the option is enabled (this is the purpose of this issue).

@mattab @peterbo I copied into the guide the original docs that were there before changing the behaviour in Matomo 3.13 or so. Do you know what is expected here or how it works? I think the code is likely right but the docs aren't correct.

@AAudusseau commented on December 16th 2020

Just FYI if you're using Matomo Cloud then we can change this for you.

Yes that would be perfect, my instance is located at https://opc.matomo.cloud Thanks!

@peterbo commented on December 16th 2020 Contributor

#

I copied into the guide the original docs that were there before changing the behaviour in Matomo 3.13 or so. Do you know what is expected here or how it works? I think the code is likely right but the docs aren't correct.

This should be how it works when it is enabled (userID overwrites visitorID). @AAudusseau what is exactly happening, when you're trying the use case?

Can be quite different, if you do those requests Server-to-Server, because the server doesn't use a cookie for recognition, after you don't pass the UserID anymore with the request.

@AAudusseau commented on December 16th 2020

Right now when the enable_userid_overwrites_visitorid option is enabled, when the visitor logs-in the existing previous visits (login page for instance) are not re-used, so the result is one user, 2 visits, one unique visitor.

image

In red the login page visit (no userID set), and in green authenticated pages (userID set).

@tsteur commented on December 16th 2020 Member

Yes that would be perfect, my instance is located at https://opc.matomo.cloud Thanks!

Hi @AAudusseau we'll be happy to make that change. Could you contact support@matomo.cloud for this change? Just so we can verify that you are the owner of that account.

@Atala commented on February 22nd 2021

I have the same issue. I don't understand why having enable_userid_overwrites_visitorid = 0 would fix this behavior. If I understand correctly the docs the behavior @AAudusseau and I wants is enable_userid_overwrites_visitorid = 1 (matomo 4 default). According to the docs :

When β€œUser ID overwrites Visitor ID” feature is enabled

When a visitor connects to your website and is not logged-in (User ID is not set) then a visit is created. If the visitor then logs-in your website and has a User ID set then their existing visit will be re-used (the visit without User ID that is created when the user was not logged in yet). All requests where this User ID is set will all be added into this same visit. Result: one user, one visit, one unique visitor. (if User ID was not used it would also have created one visit and one unique visitor).

(ref: https://matomo.org/docs/user-id/#when-user-id-overwrites-visitor-id-feature-is-enabled)

so I think the docs is still not correct ? or other bug

I contacted support as well

@AAudusseau commented on February 23rd 2021

@Atala the doc has not changed so I agree it is still incorrect.

This Issue was closed on December 14th 2020
Powered by GitHub Issue Mirror