Last modified January 14, 2021 by Shelly Wolfe

Should I use a user ID or device ID?

This article details the differences between the Swrve user ID and device ID and will help you determine which ID to use in your integration.


What does the Swrve ID do?

In Swrve, this ID is used to track a user for KPI reports, segmentation, and dynamic content delivery. IDs are essential in delivering unique content and analyzing individual behavior.

What is a device ID?

A device ID is an ID which tracks the device the app is used on. This ID is different for each device and is typically not persistent across uninstall/reinstalls of the same app.

What is a user ID?

A user ID is an ID that follows a specific user. This ID follows a user when they use different devices and is persistent across installs. Typically a user ID is used with apps that require payment outside of an app store or require a login to obtain the user’s profile.

What ID does Swrve use to identify users?

By default, Swrve’s most recent SDK uses random generated universally unique identifiers (UUIDs) that are stored in the device for future use. Swrve has always used a device ID, unique to the device being used.

When should I use a user ID instead of the Swrve default ID?

You should use a user ID when you want to track the behavior of a person, rather than the behavior on a device. Consider the following:

  • Do you use a user ID to track users across different apps or platforms? If so, you should consider overriding the default Swrve ID, and sending this custom ID. If you’re interested in following a user through different devices and installs, a user ID is needed. Titles like role-playing games and merchant apps may require a user ID to be used for tracking personal information already. As long as this is unique for each user, send this user ID to Swrve instead of the default ID.
  • Do you assign a user ID to the user in every circumstance? If a user can circumvent creating or being assigned a user ID by clicking ‘No Thanks’, or ‘Continue without Login’, we recommend using the default Swrve device ID, since you will need to account for anonymous player IDs, which ultimately are only device-specific.
  • Are you interested in tracking device or user behavior? User behavior can change across devices, but if you’re interested in following a user through different devices and installs, a user ID is needed.
  • Is this app publicly available with Swrve already integrated? If Swrve is already integrated with your app, changing is not recommended. This can have adverse effects, because old users that don’t update will still have the old ID. Historical data will also be based on a different ID. If you’re not forcing an upgrade for your users, we highly recommend NOT changing the ID. If you have already implemented a user ID in Swrve, the reverse applies as well.
  • Do you use other third party analytics? If you already track and compare reports against another third party software with a user ID, you can send this same ID to Swrve to compare similar data.

What affect would using a different ID have on my Swrve setup?

Note: Changing the ID when your app has already been released to the public will likely cause incorrect reporting in Swrve.

Swrve recommends only using a different ID during the initial integration. Historical data, as well as users who don’t update to a new app version, will keep having their reporting based off of the old ID, which makes reporting extremely difficult.

Using a custom ID can have a major effect on the statistics and content delivery in Swrve. Segments, A/B test experiences and metrics will change and can have unexpected behavior. See the below example for how this may affect your data:

Example:

A user logs in and uses the app on their iPhone. The same day, that same user logs into their iPad and begins using the app.User ID:

  • The iPhone device details are overwritten by the iPad information (Device Height/Width, OS Version, Push token).*
  • The DAU/MAU remains at 1.
  • Date of install remains the same for the user, as we know when they first played ever.
  • If the user was latched into an A/B test, there is no concern that they are no longer part of that A/B test when playing on the different device.
  • Push notifications would only be received on the most recently used device.

Device ID:

  • The iPhone device details remain the same, but a second user is created with iPad details.
  • DAU/MAU is now 2.
  • Date of install is date installed on device, rather than when a user first installed an app ever.
  • If that user is in an A/B test on the first device, they may join a different variant, or not receive the same A/B test on that different device.
  • Push notifications would be received on both devices, but only if both devices qualify for the message.

Using a user ID or device ID has no adverse effects on in-app message delivery, unless the message is delivered to a segment where the current device wouldn’t qualify for the message.

*Swrve overwrites device data with the most recent details.

How do I change to using a user ID instead of device ID?

You will need to initialize the Swrve SDK with your custom ID. See the below code examples:

SDK Code Change:

Initialize the Swrve SDK with your custom ID to use a user ID, similar to below:

iOS

// Retrieve your User ID and use it to initialize Swrve
NSString *customID = [[NSUserDefaults standardUserDefaults] objectForKey:customUserID];
swrve = [Swrve sharedInstanceWithAppID:appId apiKey:apiKey userID:customID];

Android

int appId = 123;
String apiKey = "test";
// Retrieve your user ID and use it to initialize Swrve
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
// Create Swrve config object and include in initialization code
SwrveConfig config = new SwrveConfig();
config.setUserId = prefs.getString("userID"), null);
SwrveSDK.createInstance(this, appId, apiKey, config);

Unity

// Retrieve your User ID, store it in Config and then initialize Swrve
SwrveComponent.Instance.Config.UserId = PlayerPrefs.GetString("custom_identifer");;
SwrveComponent.Instance.Init("your_app_id", "your_api_key");

Are there any privacy concerns with using a user ID?

You should confirm with your content distributors that proper privacy policies have been implemented to protect the privacy of your users.