User Identifiers

Share your User ID with Qonversion to manage user access on various devices and platforms.

User identification is essential for a mobile application with an in-app subscription. Each subscriber should have a User ID that identifies them within your app. With Qonversion, you can use different ways to identify your users within the app based on your requirements.

1. Qonversion User ID

Qonversion creates a unique User ID each time an app is installed and opened for the first time.
To use Qonversion User ID, call the userInfo method. You can use Qonversion User ID for third-party integrations or other purposes like matching data from webhook notifications to your server.

Qonversion.shared().userInfo { user, error in
  // use user?.qonversionId
}
[[Qonversion sharedInstance] userInfo:^(QONUser * _Nullable user, NSError * _Nullable error) {
  // use [user qonversionId] if no error occurred
}]
Qonversion.getSharedInstance().userInfo(new QonversionUserCallback() {
    @Override
    public void onSuccess(@NonNull QUser user) {
        // use user.getQonversionId()
    }

    @Override
    public void onError(@NonNull QonversionError error) {
        // handle error here
    }
});
Qonversion.shared.userInfo(object : QonversionUserCallback {
    override fun onSuccess(user: QUser) {
        // use user.qonversionId
    }

    override fun onError(error: QonversionError) {
        // handle error here
    }
})
try {
  final userInfo = await Qonversion.getSharedInstance().userInfo();
  // use userInfo.qonversionId
} catch (e) {
  // handle error here
}
try {
  const userInfo = await Qonversion.getSharedInstance().userInfo();
  // use userInfo.qonversionId
} catch (e) {
  // handle error here
}
Qonversion.GetSharedInstance().UserInfo((user, error) =>
{
    if (error == null)
    {
        // use user.QonversionId
    }
    else
    {
        // Handle the error  
        Debug.Log("Error" + error.ToString());
    }
});
curl --location --request GET 'https://api.qonversion.io/v3/users/QON_38a2d811afd54a433587620f8696266e' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer '

{"created":1658489733000,"environment":"prod","id":"QON_38a2d811afd54a433587620f8696266e","identity_id":"your_custom_user_id"}

2. User ID for third-party Integrations

Qonversion SDK provides an asynchronous method to set your user ID, which will later be sent to third-party integrations you enabled.

Qonversion.shared().setProperty(.userID, value: "yourSideUserId")
[[Qonversion sharedInstance] setProperty:QONPropertyUserID value:@"yourSideUserId"];
Qonversion.getSharedInstance().setProperty(QUserProperty.CustomUserId, "yourSideUserID");
Qonversion.shared.setProperty(QUserProperty.CustomUserId, "yourSideUserID")
Qonversion.getSharedInstance().setProperty(QUserProperty.customUserId, 'yourSideUserId');
Qonversion.getSharedInstance().setProperty(UserProperty.CUSTOM_USER_ID, 'yourSideUserId');
Qonversion.GetSharedInstance().SetProperty(UserProperty.CustomUserId, "yourSideUserId");
Qonversion.setUserId('yourSideUserID');

🚧

Use User ID for third-party Integrations to attribute events to existing users in other platforms. For managing user access across multiple devices or Apple and Google app stores, use User Identifiers.

3. User Identity

User Identity allows cross-device & cross-platform user identification and access management.

🚧

Use the documentation below and the User Identity concept only if you want to manage user access across multiple devices or Apple, Google and Web platforms for users logged into their accounts within your apps.

If you need to assign your user ID for analytical purposes, use the setProperty() method described above.

User identification is critical in building cross-platform apps where you want to manage user access based on payments across different platforms. This can be a complex task as users can log in and out of your application, use multiple devices, or reinstall the app.
To provide flexible subscription infrastructure and consistent data, we have built a comprehensive solution using a combination of Qonversion IDs, your backend IDs, and the merging concept for users.

Qonversion lets you identify your signed-in users and unlock premium access across multiple devices. Use the identify() method to link a user to your signed-in subscriber. Call this method every time you want to use User Identity. For example, when a user logs in.
User Identity provides a convenient way of managing premium access of your existing subscribers, including the following cases:

  • A user reinstalls your app for any reason. Using the same User ID allows you to provide premium access linked to previously purchased products.
  • A user logs in on several devices. You can provide premium access based on a subscription purchased on one of his devices.
  • A user logs in on iOS and Android versions of your app. You can provide premium access based on a subscription purchased on one of the platforms.

Logging in

When a user logs into his account, call identify().

Qonversion.shared().identify("your_custom_user_id")
[[Qonversion sharedInstance] identify:@"your_custom_user_id"];
Qonversion.getSharedInstance().identify("your_custom_user_id");
Qonversion.shared.identify("your_custom_user_id")
Qonversion.getSharedInstance().identify("your_custom_user_id");
Qonversion.getSharedInstance().identify('your_custom_user_id');
Qonversion.GetSharedInstance().Identify("your_custom_user_id");
curl --location --request POST 'https://api.qonversion.io/v3/identities/new_identities_user' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "user_id": "QON_38a2d811afd54a433587620f8696266e"
}'

{
    "id": "new_identities_user",
    "user_id": "QON_38a2d811afd54a433587620f8696266e"
}

🚧

Always use unique user ID values. Otherwise, a user can get matched to another user's premium status.

To check entitlements for identified users, you can call checkPermissions()
You can check the details of setting up permissions (entitlements) here.

Logging out

You need to call the logout() method to handle entitlements for an unauthorized user.
Call this method when a user logs out within your app:

Qonversion.shared().logout()
[[Qonversion sharedInstance] logout];
Qonversion.getSharedInstance().logout();
Qonversion.shared.logout()
Qonversion.getSharedInstance().logout();
Qonversion.getSharedInstance().logout();
Qonversion.GetSharedInstance().Logout();

When a user logs back into his account, don't forget to use identify method again.

Examples

Let's look at the following examples to better understand Qonversion.identify().

🚧

In the following examples:

  • Anonymous ID corresponds to the same app store account (Apple or Google).
  • A and B correspond to two different app store accounts (Apple or Google).

Example 1. No User Identity.

Two anonymous users install the app and subscribe without using identify(). These users are not linked to each other and have different access.

Anonymous IDUser IDAction
AnullInstall
BnullInstall
BnullStart Subscription X
AnullStart Subscription Y

Now let's look at using identify().

Example 2. Default multiple devices subscription flow.

A user installs the app on his iPhone first. Later he installs the app on his second device (iPad/Android device/etc). He makes a purchase and creates an account on the second device. Later he uses the same credentials to log into the app on his iPhone.

Anonymous IDUser IDAction
AnullInstall
BnullInstall
BnullStart Subscription
Buser_id_1identify("user_id_1")
Auser_id_1identify("user_id_1")

In this case, Qonversion will provide users A and B the same entitlements while they use the same user_id_1.

Example 3. Log in & Log out. One anonymous user.

A user installed the app and subscribed for product X.
Then, he creates his user account in the app with the following ID: user_id_1.
Then he purchases the product Y using the same app store account.
In this case, the user has entitlements based on both products, X and Y.
When the user logs out on this device, he still has entitlements based on both products since the purchases were made using the same app store account.

Anonymous IDUser IDAction
AnullInstall
AnullStart Subscription X
Auser_id_1 (login for the very first time)identify("user_id_1")
Auser_id_1Start Subscription Y
AnullLogout

Example 4. Log in & Log out. Two different anonymous users.

First user B installed the app and subscribed for the product X. He then logs into the account with user ID user_id_1 and subscribed for product Y. This user has entitlements based on both products.

Another user A installed the app and logged in using the same user ID: user_id_1. He is immediately granted entitlements based on both products purchased by user B.

If user B logs out using the logout() method, he still has entitlements based on both purchases he made.
If user A logs out, he does not have any entitlements. His anonymous account does not have any purchases associated with him.

Anonymous IDUser IDAction
AnullInstall
BnullInstall
BnullStart Subscription X
Buser_id_1 (login for the very first time)identify("user_id_1")
Auser_id_1identify("user_id_1")
Buser_id_1Start Subscription Y
BnullLog out
AnullLog out

Example 5. Different anonymous accounts and different purchases.

Two anonymous users installed the app. User A subscribed to product Х, and user B subscribed to product Y.
User A then logs with the ID user_id_1 for the very first time. At this moment, this user ID is created.
Later user B also logs into the account under the same ID user_id_1.
Both users, when logged in, have only entitlements associated with product Х because the user ID was created from the account associated with purchase Х.
If user A logs out, he still has entitlements based on product Х.
If user B logs out, he loses entitlements based on product Х but gets back entitlements based on product Y which was initially associated with his anonymous account.

Anonymous IDUser IDAction
AnullInstall
AnullStart Subscription X
BnullInstall
BnullStart Subscription Y
Auser_id_1 (login for the very first time)identify("user_id_1")
Buser_id_1identify("user_id_1")