Need to generate new session_id if user_id changes

Hi there. We are having the issue of more than 1 users under 1 session_id. Is there a way to generate new session_id if the user_id changes?


Welcome to Snowplow @feihusong

You can call the following:


snowplow('clearUserData', { preserveSession: false, preserveUser: true });


snowplow('clearUserData', false, true);

This is only available in the latest releases of v3 and v2 of the tracker. You’ll also want to send an event straight after this as it resets the cookies and will only recreate the user_id cookie when the next event is sent.

1 Like