Last modified February 15, 2021 by Shelly Wolfe

Tracking your users with Swrve User Identity

Track individual users across multiple devices and keep your audience in clear sight with Swrve’s User Identity feature.


  • To deploy the User Identity feature and track your users across all their devices and platforms, you must have an integrated single cross-platform dashboard.
  • For native apps (Android, iOS) upgrade your app to minimum Swrve SDK 6.0.
  • For OTT platforms, ensure your app uses the latest SDK that supports User Identity.
  • Use an app-specific, non-discoverable ID to identify your users across devices, platforms, and channels.
  • If you’re using an external user ID with the Swrve Event or Push APIs or with any Salesforce Journey Builder custom Swrve activities, you must also generate an Identity secret key on the Integration Settings screen for your app. For more information about managing your API keys, see Integrate your app.

Tracking user behavior with Swrve

Swrve identifies each individual in the user flow, and assigns them an SDK-generated Swrve user ID the first time they use an app after installing it on a device. The Swrve user ID enables you to track users across multiple devices, platforms, and channels, by linking it to the external user IDs you provide for each of your app users.

We use the linked user ID to:

  • Identify and track users across multiple devices.
  • Distinguish between different users on one device.
Do not use email or other personally identifiable information (PIIs) for the external user ID, as this could be used to compromise your app or integration. Instead, identify your users to Swrve using an internal ID that is only known to your CRM and cannot be linked back to a user outside of your system.


Swrve checks if the user has been previously identified or whether it’s the first time the user identity has logged into the app on a device. How the user identity is then handled depends on the scenario:

  1. Anonymous user installs the app on a new device.
  2. Identified user installs the app on a new device.
  3. New user logs into the installed app on a known device.

Scenario 1: Anonymous user installs the app on a new device

Anonymous user installs app on device

  1. When a user first installs and opens an app on a device, the user is anonymous.
  2. The Swrve SDK assigns them a randomly generated user ID, for example, XXX, and uses it to anonymously track their behavior on the device.
  3. The user registers and identifies to the app on the device.
  4. The External user ID is passed and linked to the Swrve user ID XXX. The user’s subsequent activity on the device is then tracked under the Swrve user ID XXX.

Scenario 2: Identified user installs the app on a new device

Known user identifies on unknown device

  1. The same user installs the app on a different device, for example, their tablet.
  2. The first time they open the app, the SDK generates a Swrve user ID, for example, XYZ, and uses it to anonymously track their behavior on the tablet.
  3. The user logs into the app with their External user ID.
  4. The External user ID and Swrve user ID XYZ are checked against the database.
  5. Since the External ID was previously linked to Swrve user ID XXX, Swrve returns user ID XXX. User ID XYZ is discarded and all subsequent activity on the tablet is tracked under Swrve user ID XXX.

Scenario 3: New user logs into an installed app on a known device

New user identifies on a known device

  1. A new user registers and identifies with the app on a device shared with another user, for example, a tablet.
  2. The SDK generates a new Swrve user ID, for example, YYY, that is sent with the user’s External user ID.
  3. Swrve checks to see if the External user ID has previously been seen before, and if not, links it to the new Swrve user ID. The new user’s subsequent actvity on the tablet is tracked under Swrve user ID YYY.

For in-app message campaigns, Swrve only contacts the current user. Depending on your target audience, all users could receive push notifications, unless you use the authenticated push option. Use this option to ensure the notification is only displayed for the user who was last logged into the app.


Reinstalling is essentially scenario 2. If a user reinstalls an app and then re-identifies with the same app-specific ID, all further activity is logged against their existing Swrve user profile and aggregated with their historic pre-uninstall behavior.

Using the Swrve Identity API

External user IDs

Create an app-specific external user ID to identify your users. The ID should be non-discoverable and not include any personally-identifiable information (PII), for example, email addresses or phone numbers.

Identification process

The external user ID is listed in the User Database Export files in the format: Swrve.external_user_id. The app passes the external user ID to Swrve.

The Swrve Identity API links the swrve_user_id passed up from the client along with the external_user_id. You can use either the swrve_user_id or the external_user_id with Swrve’s Event APIs for ad-hoc user property updates and event logging, and with the Push API, to identify users.

When the user logs into your app, the following happens:

  • A session start event is logged against the newly identified user, if there is a change of user, otherwise no session start is logged.
  • All resources, campaigns, and tests refresh.

Tracking identified users

Once the SDK has identified the user, Swrve logs a user property called Swrve.user_type=known. Use this property to track one of the following:

  • anonymous (unknown) users
  • previously identified users associated with specific campaigns

User database export

The External user ID and Swrve User Type properties are both listed in the Swrve User Properties file in the User DB export files.

Push notifications

Push notifications are sent to the device the user was last active on. If your app is configured to support Background app updates, you can restrict push notifications to display only on the devices of users currently ‘identified’ with a device (for example, logged-in).

To do this, when you define your target audience, select Check identity of push recipient.

On the Audience builder screen, you have the option to verify the identity of the push notification recipient and only display it if they are the last logged-in user. Select the checkbox to use this option.

Resource A/B tests

Once a user logs into a device, all in-app messages, conversations, resources, or resource A/B tests are downloaded to the device and will follow them to any other devices they subsequently log into.