Skip to main content

Hello, I have not setup Amplitude in my codebase yet but am planning to use HTTP API as it seems the easiest method with our Nextjs app. I have been testing on Postman and have a rough idea what I’d be expecting in the response. However, I’m a little bit confused with passing in user_id in event’s params. For example, I’d like to track an Onboarding event flow which consists of multiple events, button clicks and page viewing whilst the user is on each page of the sign-up process. Please clarify if this should be a funnel of the Onboarding event:

  1.  A user fills in all his details on the sign up form - tracking sign up page (pageview), get user’s device_id
  2. The user hits the ‘sign up’ button after filling the form - tracking button clicked, device_id sent on payload as the user does not yet have a user_id (our current app is storing user’s external_reference as the id)
  3. The user is directed to our ‘Connect to data source’ page, if user opts to explore sandbox or gets stuck on this page - tracking connect to data source page (pageview), user_id (external reference) is generated in this step.
  4. A datasource is selected to be connected - Tracking ‘connect’ button clicked, user_id and device_id added as params
  5. Setup final page - Tracking final sign up page (pageview) and preparing dashboard button, user_id and device_id added as params

Following each of the flow mentioned above where only the device_id is initially passed in the param, how do we update the newly generated user_id (external-reference) to merge with the device id when we want to track events after the onboarding flow?

Hi @Aznim Rahman 

The general best practice is to not assign any explicit user ID for anonymous users.

These users will still have Amplitude IDs and device IDs. Users will automatically be merged when Amplitude recognizes the different user IDs belong to the same user. You don’t need to add the “external reference” as user_id since Amplitude will consider any new value in the user id field as a new different user.

You can read more on how Amplitude tracks unique users - https://help.amplitude.com/hc/en-us/articles/115003135607-Track-unique-users


Reply