Manually start new visit

I using the custom variables to save the user id if someone logs into my site per visit.

My problem is that because it’s tracked per visit I don’t know when a user logged in and out with different accounts.

I thought about it for a while and thought of a few ways to fix this:
[li] set variable per page instead of visit
[/li][li] create a goal for logging in
[/li][li] somehow start a new session when logging in with id different from custom variable
I think the last is the best way as it’s save to assume that most times the same visitor won’t log in with more than one account.

So my question is: Is there a way to tell Piwik to start a new visit, preferably with the JS API.
Or is there a better option?


I’m interested in this too. I’d like to track activity on my website on a per user basis.

I agree with you, your last suggestion in theory is the best solution but I’m not sure if this possible. I might attempt your second solution.

Look forward to hearing from others who can help in this area.

Until I know a better way I will save the current user id in a custom user variable but I really think it should be possible to force a new visit without any hacks.

Here’s some people who are looking for the same thing:,93636,84499,84499

Here is the feature requesT: Accurate User Detection cross devices: User ID (set in JS and all other clients) · Issue #3490 · matomo-org/matomo · GitHub

please consider making a donation to sponsor this ticket :slight_smile: