Solved

Merging events retrospectively

  • 14 March 2023
  • 8 replies
  • 594 views

Badge

Hi community! Happy to be here!

I have a setup where I pull together events from website and events from an application (two separate sources).

Everything seems to work, the only thing I’m struggling with is that I don’t know how to merge the website events (by the device_id) retrospectively into a new user_id.

Example:

  1. A new user signs up and does something in the app → a user_id #1 is created (= new account in the app) and the events from the website (“Try free” click, “Sign-up form”, etc) are attributed to user_id #1
  2. The user logs out and leaves
  3. The same user returns in the same browser and creates a new account (goes through p.1 with new credentials) → a user_id #2 with the device_id #1 (same as in p.1)

What ends up happening is the website events in p.3 (“Try free” click, “Sign-up form”, etc) are attributed to user_id #1 even after user_id #2 is created.

Question: how do I make the website events after the logout merged into the user_id #2 by the device_id #1?

I’d appreciate any help!

icon

Best answer by Saish Redkar 22 March 2023, 22:11

View original

8 replies

Userlevel 6
Badge +9

Thanks for reaching out here @mike kosorukov. Our Help Center has more information on merging events here and merged users here. This is useful if you’re tracking two or more events that you would like to track as one single event instead or when Amplitude determines that an anonymous user—i.e., one whose only ID is a device ID—is actually a recognized user with an Amplitude ID. Please let us know if you need additional help!

Badge

Thanks for reaching out here @mike kosorukov. Our Help Center has more information on merging events here and merged users here. This is useful if you’re tracking two or more events that you would like to track as one single event instead or when Amplitude determines that an anonymous user—i.e., one whose only ID is a device ID—is actually a recognized user with an Amplitude ID. Please let us know if you need additional help!

Hi Jeremie, thanks a lot!

Unfortunately, the links you provided are leading to this post! Can you please provide the proper links?

Thanks!

Userlevel 6
Badge +9

My mistake. Here you go. Our Help Center has more information on merging events 

Badge

Thanks @Jeremie Gluckman! I dug deeper but couldn’t find exactly my case, but it seems like it falls into the “transformations” feature, can you give me a helping hand here and clarify this please?

Pretty much the only thing I want to do is (using SDK or API or in-app) make changes to the existing list of events (add or change user_id) and then send the changed events back to Amplitude.

Is there any way to do it outside of the “transformation” feature? (we don’t have Govern add-on yet=)

Thanks!

Userlevel 6
Badge +9

Thanks for getting back to me on this. I’ll confirm with our support team and make sure we circle back.

Userlevel 7
Badge +10

Hi @mike kosorukov 

You can read more on how Amplitude tracks unique users and the caveats associated with device ids here - https://help.amplitude.com/hc/en-us/articles/115003135607

 

If I’m understanding your use case correctly, then it seems like you need to do a userid reset once the user log outs and  regenerate your device id. This is explained in here - https://www.docs.developers.amplitude.com/data/sdks/javascript/#logged-out-and-anonymous-users

 

Hope this helps.

Badge

@Jeremie Gluckman, @Saish Redkar thank you a lot for your help! Looking into this

Userlevel 6
Badge +9

Sure thing @mike kosorukov

Reply