Amplitude-Flutter icon indicating copy to clipboard operation
Amplitude-Flutter copied to clipboard

Get Amplitude ID

Open jtmuller5 opened this issue 1 year ago • 1 comments

Summary

Add a method to the Amplitude SDK to access the current user's "Amplitude ID".

Motivations

We have a funnel that allows a user to login half way through. For the first ~5 events, the Amplitude user ID is null so all events get recorded using the auto-generated "Amplitude ID". When the user logs in, we identify the user on the server side and a new session is created with the User ID and Amplitude ID equal to the logged in user ID.

Ideally, we want to pass the Amplitude ID from the front end to the backend so the user can be merged with an existing Amplitude ID.

The getUserId method returns null when a specific "User ID" hasn't been set.

image

jtmuller5 avatar Oct 27 '22 17:10 jtmuller5

Hi @jtmuller5, in Amplitude, we will merge the user and events after later setting the userId. You can read more here. The getUserId in SDK is only for the user id set via the SDK.

qingzhuozhen avatar Oct 28 '22 04:10 qingzhuozhen