Why is amplitude sdk regenerating device Id on every session/tab on the web on desktop?

1.3k views Asked by At

I am using the amplitude Javascript SDK. Following the documentation: at https://help.amplitude.com/hc/en-us/articles/115003135607-Tracking-Unique-Users I assumed Amplitude sdk would by itself set up a single device id (as the name suggests) for the computer that I use and would send the same device id for any browser I use (unless I set a custom userId with setUserId method). Not only it sends different deviceIds for different browsers, it also sends regenerates device id for any tab/session.

How can I prevent it from happening?

2

There are 2 answers

0
GA1 On BEST ANSWER

I have contacted the Amplitude support, there was a bug in the amplitude SDK. As stated in the question, DeviceId should not be changed when we open a new tab or reopen the window within the same browser and user (not incognito).

Updating the amplitude sdk version from 6.2.0 to 7.1.0 solved this problem!

0
Kimmo Hintikka On

Amplitude SDK generates device ids for each browser separately. Once you use the same device id across these browsers we merge the user actions under one user. This happens with historical events as well.

If you have a new device id's in each tab however you must be calling regenerateDeviceId somewhere in your code.