Tracking your users with Swrve User Identity
Prerequisites
- 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 a 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.
Scenarios: User installs app and logs in to device
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 and how you’ve configured the SDK to start tracking user activity. For example:
- Anonymous user installs the app on a new device.
- Identified user installs the app on a new device.
- New user logs into the installed app on a known device.
- New user installs the app, but SDK delays tracking until login
Scenario 1: Anonymous user installs the app on a new device
- When a user first installs and opens an app on a device, the user is anonymous.
- The Swrve SDK assigns them a randomly generated user ID, for example, XXX, and uses it to anonymously track their behavior on the device.
- The user registers and identifies to the app on the device.
- 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
- The same user installs the app on a different device, for example, their tablet.
- 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.
- The user logs into the app with their External user ID.
- The External user ID and Swrve user ID XYZ are checked against the database.
- 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
- A new user registers and identifies with the app on a device shared with another user, for example, a tablet.
- The SDK generates a new Swrve user ID, for example, YYY, that is sent with the user’s External user ID.
- 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.
Scenario 4: New user installs app, but SDK delays tracking until login
By default, Swrve tracks any activity that takes place prior to the user identifying as anonymous, however it’s possible to configure the SDK to delay tracking until the user identifies themself to Swrve. When the SDK is configured to delay tracking until the user identifies themself to Swrve, user identity is handled as follows:
- User first installs and opens an app on a device.
- Swrve does not track their behavior on the device.
- The user registers and identifies to the app on the device.
- The External user ID is passed and linked to a randomly generated Swrve user ID XXX.
- The user’s subsequent activity on the device is then tracked under the Swrve user ID XXX.
For more information on how to delay tracking activity until the user identifies themself, see the relevant integration guide:
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 Check identity of push recipient option. For more information, see Push Notifications.
Reinstalling
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.
Scenarios: Logging in and logging out
The following section explains how user behavior is tracked across logins, logouts, and app opens. Swrve allows you to stop tracking the user’s behavior when they log out and wait for a subsequent log in to resume tracking. Additionally, Swrve lets you decide how you want to resume tracking when a user reopens the app, if they did not log out in their previous session. How tracking is handled depends on the scenario:
- Identified user logs out and subsequently logs in, without closing the app.
- Identified user closes the app and reopens it without logging out.
- Identified user closes the app and is automatically logged out.
Scenario 1: Identified user logs out and subsequently logs in
- The user logs into the app.
- Swrve begins tracking behavior against Swrve user ID XXX.
- The user logs out of the app.
- All subsequent actions performed by the user are not tracked in Swrve.
- The user logs back into the app.
- Swrve resumes tracking behavior against Swrve user ID XXX.
Scenario 2: Identified user closes and reopens app, without logging out
- The user logs into the app.
- Swrve begins tracking behavior against Swrve user ID XXX.
- The user closes the app, without logging out.
- Another user opens the app, but does not log in.
- Swrve automatically resumes tracking against the previous user’s Swrve user ID XXX.
- The other user logs in.
- Swrve starts tracking against the different user’s Swrve user ID YYY.
Scenario 3: Identified user closes app and is automatically logged out
By default, the Swrve SDK starts tracking against the last known Swrve user ID when the app is reopened, as explained in the above scenario. However, if you opt to delay tracking until a user has identified themselves, user identity is handled as follows:
- The user logs into the app.
- Swrve begins tracking against the user’s Swrve user ID XXX.
- The user closes the app, but does not log out.
- Another user reopens the app, but does not log in.
- Swrve does not resume tracking.
- The other user logs in.
- Swrve starts tracking against the other user’s Swrve user ID YYY.
For more information on managing how you track user behavior in the SDK, see the relevant integration guide:
Using the Swrve Identity API
Once you’re SDK is configured to manage User Identity, use it to target and report on your users across Swrve in the following areas:
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, per platform. If your app is configured to support Background app updates, you can restrict push notifications to display only if the intended recipient is the user who was last logged into the app. Note that if the push notification’s intended recipient is currently logged out, then the push notification is not displayed.
To do this, when you define your target audience, select Check identity of push recipient.
Resource A/B tests
Once a user logs into a device, all in-app messages, embedded campaigns, resources, or resource A/B tests are downloaded to the device and will follow them to any other devices they subsequently log into.