Problem with changed idvisitor and idvisit after login

Hi all,
We have a strange problem with matomo log: idvisitor and idvisit of a viewer both change after he/she logs in. My understanding is that after logging in, the viewer’s idvisitor and idvisit should remain the same.
I tested the situation with my own account. When I checked the idvisitor value in Chrome DevTool, everything looked fine. However, in the matomo log collected, both idvisitor and idvisit values changed after log in.
Is there any suggestion for fixing this issue?

Hi @fangyi
Do you use userId while tracking?

Hi Philippe @heurteph-ei
Yes, we are using userId.
I can see my account information in the user_id column of matomo log, but the idvisitor value of the entry is different from the idvisitor before login (i.e. also different from the value I saw in Chrome DevTool when testing). This makes us unable to track a viewer’s journey before login.
During login process, the viewer will be briefly directed to another domain to key in login information, and then directed back to the same page. Could this be the cause of changed idvisit and idvisitor in matomo log?

Hi @fangyi
Is it related to: