Visitor ID vs userid

Good afternoon to all,

I am facing the following issue :
Each time a visitor logs into my site, i assign a userid.
But this makes me lose all the information related to the pages viewed and the acquisition (page of origin, etc) recorded when the visitor was not yet logged in. More specifically, matomo behaves exactly as if there were two different visitors. As a consequence, i can not properly assign a sale to the right source.
This seems in total contradiction with the documentation which states : When a User Logs In During a Visit

*When a visitor connects to your website but is not initially logged in, their visit is associated with a Visitor ID by default. This is a unique identifier for that specific visit that is not attributed to a specific user. However, once that user logs into their account and you set a User ID for this visitor, then all actions such as page views are linked to the User ID and not the visitor ID. Any previously tracked action for this visitor before the user was logged in is also associated with this User ID.

When a user logs in, Matomo counts all actions before and after logging in as one user, one visit, and one unique visitor."

Has anyone faced the same problem ? Do you how to get it solved ?

Many thanks in advance

There are several ways to use the user id. Which one do you use? Here is an overview:

Here are infos about the matomo keys / data base entrys:
https://developer.matomo.org/guides/database-schema

1 Like

Dear melbao,
I use the javascript method.

Best regards,

Hi @eesneu
Can you share the tracking code you use in the first page of tracking and also after the user has logged in…?
Also, maybe have a look at:

Hi @heurteph-ei,

I managed to solve the issue by adding

_paq.push(['setConversionAttributionFirstReferrer', true]);

to the code.

Not sure to understand why but at least it works. Many thanks for your help.

1 Like