How can the userId be randomized for each session of the same user?
There are several reasons why companies want to generate a new userId
for each session. How this works on web is outlined here. Please note that when you decide to randomize the userId as outlined below, the metric Unique Users
will be equal to the Plays
metrics.
On Android
On Android there is a setting in the AnalyticsConfig
called randomizeUserId
. If this setting is set to true
, then every time the collector is attached, a new userId
will be generated. If a user is watching with a playlist, the user will have the same id for every video in the playlist.
If this setting is set to false
then Settings.Secure.ANDROID_ID
will be used as userId
, which is not a random value! false
is the default value.
On iOS
On iOS the behaviour is consistent with the one on Android. In the AnalyticsConfig
there is a setting called randomizeUserId
. If this setting is set to true
, then every time the collector is attached, a new userId
will be generated.
If this setting is set to false
, then a random ID is generated, stored in the UserDefault Store
, and retrieved every time the user starts a session. false
is the default value.
Updated about 1 year ago