Best practice for device_id when there is none available? (external platform + http api)

  • 2 October 2021
  • 2 replies


Hi everyone!


A bit of context for the question:

Newbie question here. We host our platform with an external provider. The access to the events happening there (student registered, canceled, register for a course, etc) are made available to us via Zapier. From there we could use the event and the data to feed other platforms (n8n, local dbs). 

I wanted to use that trigger to send the same data to amplitude. The thing is, I don’t have access to device_ids from our users (as the data will be ingested using the http api from one of our servers after receiving the data from Zapier). 

I’m aware that we will lose track of the relation user↔devices but we can live with it. 


My doubt

What would be the best practice with the device_id value?

  • Not sending anything (not sure if that’s possible though)
  • Send a random uuid for every event?
  • Send a random uuid for every user?
  • Any other options I’m not aware of? 

Same question applies to session_id (I thought about setting a session start that covers 24h) but I’m not aware of the implication this behaviour could have.


Thank you very much for your thoughts about it,  


Best answer by MikkoKarvonen 4 October 2021, 07:53

View original

2 replies

Userlevel 4
Badge +2

The answer depends a bit on what you want to get out of your data.

The role of the Device Id is to act as a pseudo identifier for the user if you don’t have User Ids for them (I assume you don’t). If you give a random Device Id to each event, you’ll have a unique user for each event. This does limit the analysis you can do somewhat, so I’d assign a random Device Id for each user instead, if you have that option. It does not seem wise to limit yourself if you have a way not to do that.

Session Ids will really affect only your ability to use the Sessions view and the way the events are listed when you are viewing the event stream of a single user, so you can choose many approaches here without affecting your analysis much. Your suggested approach sounds fine. Alternatively, setting the Session Id as -1 tells Amplitude to ignore the session data altogether. And if I remember correctly, Amplitude web sdk creates a new Session Id if more than 30 minutes have passed since the previous event from that user.


Thank you very much @MikkoKarvonen, really appreciate the time answering my question.

Just to clarify, I do have user_id (imagine a learning platform managed by a 3rd party where I get the event of a course registration via zapier).

So, based on your comments I’ll go with:

  • user_id: the one received by zapier (coming from a real user_id on the platform).
  • device_id: ignored as I can identify the user per user_id, being aware that I won’t be able to user filtering by device, obviously.
  • session_id: -1 or not sending anything (which I believe sets session_id with -1).

At least we will be able to see metrics by user and analyse user flow even though we won’t be able to filter by session or device.

Sounds reasonable? 

Thanks again for your help! 💪