Analytics (Observer) Mode

Implement subscription analytics in 20 minutes without changing your existing in-app purchases flow.

Analytics mode allows you to get the best-in-class analytics in minutes. You can also use real-time subscriptions events in third-party integrations, webhooks, and get accurate Apple Search Ads attribution using this mode. You don't need to make any changes to your current in-app purchases flow.

After you install the SDK, follow the steps below.

1. Launch SDK

Import the Qonversion SDK in your module that is responsible for launching third-party dependencies:

import Qonversion
#import "Qonversion.h"
import com.qonversion.android.sdk.Qonversion;
import com.qonversion.android.sdk.Qonversion
import 'package:qonversion_flutter/qonversion_flutter.dart';
import Qonversion from 'react-native-qonversion';
using QonversionUnity;

Initialize the SDK:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    Qonversion.launch(withKey: "projectKey")
    Qonversion.disableFinishTransactions() // call this function if you want to finish StroreKit transactions by yourself, after handling the purchase on your own backend
    
    return true
}
#import "Qonversion.h"
  
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [Qonversion launchWithKey:@"projectKey"];
    [Qonversion disableFinishTransactions]; // call this function if you want to finish StroreKit transactions by yourself, after handling the purchase on your own backend

    return YES;
}
public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Qonversion.launch(this, "projectKey", true);
    }
}
public class App : Application {
    override fun onCreate() {
        super.onCreate()
        Qonversion.launch(this, "projectKey", true)
    }
}
Qonversion.launch('projectKey', isObserveMode: true);
Qonversion.launchWithKey('projectKey', true);
public class QonversionLauncher : MonoBehaviour
{
    private void Start()
    {
        Qonversion.Launch("projectKey", true);
    }
}
Qonversion.launch('projectKey', true);

Get your Qonversion Project Key

📘

Installation the SDKs in Analytics Mode

Please check the Google Play Billing Library version in your in-app subscription implementation. For the library version 3.x.y, you have to use:

  • the major version of the Android SDK 2.x.y
  • the major version of the Unity SDK 2.x.y
  • the major version of the Flutter SDK 3.x.y
  • the major version of the React Native SDK 2.x.y
  • the major version of the Cordova SDK 0.x.y

In other cases use the latest SDK version.

2. Sync Purchases (Android only)

  1. Check whether you have set your products up correctly. Make your GooglePlay subscriptions backwards compatible to have the best possible accuracy in Qonversion. Learn more here

  2. While you are using Qonversion SDKs in Analytics Mode, in-app purchases implementation is entirely on your side. Do not forget to consume and acknowledge purchases to attribute them to users. Otherwise, the purchases will be automatically refunded in 3 days. See the official Android Developer documentation for processing purchase details.

  3. Sync data with Qonversion in your current purchase flow. Call syncPurchases() after every purchase.

Qonversion.syncPurchases();
Qonversion.syncPurchases()
Qonversion.syncPurchases();
Qonversion.syncPurchases();
Qonversion.SyncPurchases();
Qonversion.syncPurchases();

📘

Please, do not use Google Play Billing AIDL library to integrate Qonversion SDK with your application. It was deprecated and is not supported by Qonversion SDK.

3. (Optional) Enable Server-to-Server notifications

Qonversion checks user receipts regularly and does not require server-to-server notifications from Apple or Google. Nevertheless, due to these notifications, your analytics charts, third-party integrations and webhooks will work much closer to real-time.

4. (Optional) Set User ID

If you want to implement the cross-platform (Android, IOS, and Web) user entitlement management, please, follow the User Identity guide.

To match Qonversion revenue events to users in third-party tools, you need to set the same user IDs in all of them:

Qonversion.setProperty(.userID, value: "yourSideUserId")
[Qonversion setProperty:QNPropertyUserID value:@"yourSideUserId"];
Qonversion.setProperty(QUserProperties.CustomUserId, "yourSideUserID");
Qonversion.setProperty(QUserProperties.CustomUserId, "yourSideUserID")
Qonversion.setProperty(QUserProperty.customUserId, 'yourSideUserId');
Qonversion.setProperty(Property.CUSTOM_USER_ID, 'yourSideUserId');
Qonversion.SetProperty(UserProperty.CustomUserId, "yourSideUserId");
Qonversion.setUserId('yourSideUserID');

The user ID improves the quality of events matching to the platforms where event attribution is not exclusively based on IDFA or GAID.

5. (Optional) Set IDFA (Identifier for Advertisers, iOS 14.5+ only)

On iOS 14.5+, after requesting the app tracking permission using ATT, you need to notify Qonversion if tracking is allowed and IDFA is available. This will help to have precise attribution in Adjust, AppsFlyer, Singular and other Qonversion integrations.

ATTrackingManager.requestTrackingAuthorization { status in
    switch status {
    case .authorized:
        Qonversion.setAdvertisingID()
      
    // handle other states below
    }
}
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
    switch (status) {
        case ATTrackingManagerAuthorizationStatusAuthorized:
            [Qonversion setAdvertisingID];
            break;
        
        // handle other states if needed
        
        default:
          break;
    }
}];
Qonversion.setAdvertisingID();
Qonversion.setAdvertisingID();
Qonversion.SetAdvertisingID();
Qonversion.setAdvertisingID();

6. (Optional) Set ASID (App set ID, Android 12+ only)

On Android 12+, you can provide an App set ID to have it used in Qonversion integrations.

Add com.google.android.gms:play-services-appset as the dependency to your project and write the following code.

final AppSetIdClient client = AppSet.getClient(context);
final Task<AppSetIdInfo> task = client.getAppSetIdInfo();
task.addOnSuccessListener(info -> {
    final String id = info.getId();
    Qonversion.setProperty(QUserProperties.AppSetId, id);
});
val client = AppSet.getClient(requireContext())
client.appSetIdInfo.addOnSuccessListener { info: AppSetIdInfo ->
    Qonversion.setProperty(QUserProperties.AppSetId, info.id)
}
Qonversion.setProperty(QUserProperty.appSetId, appSetId);
Qonversion.setProperty(Property.APP_SET_ID, appSetId);
Qonversion.SetProperty(UserProperty.AppSetId, appSetId);