Analytics Mode
Implement subscription analytics in 20 minutes without changing your existing in-app purchases flow.
Analytics (Observer) 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 change your current in-app purchases flow.
After you install the SDK, follow the steps below.
1. Launch SDK
Initialize the SDK:
import Qonversion
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let config = Qonversion.Configuration(projectKey: "projectKey", launchMode: .analytics)
Qonversion.initWithConfig(config)
return true
}
#import "Qonversion.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
QONConfiguration *configuration = [[QONConfiguration alloc] initWithProjectKey:@"projectKey" launchMode:QONLaunchModeAnalytics];
[Qonversion initWithConfig:configuration];
return YES;
}
import com.qonversion.android.sdk.Qonversion;
import com.qonversion.android.sdk.QonversionConfig;
import com.qonversion.android.sdk.dto.QLaunchMode;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
final QonversionConfig qonversionConfig = new QonversionConfig.Builder(
this,
"projectKey",
QLaunchMode.Analytics
).build();
Qonversion.initialize(qonversionConfig);
}
}
import com.qonversion.android.sdk.Qonversion
import com.qonversion.android.sdk.QonversionConfig
import com.qonversion.android.sdk.dto.QLaunchMode
public class App : Application {
override fun onCreate() {
super.onCreate()
val qonversionConfig = QonversionConfig.Builder(
this,
"projectKey",
QLaunchMode.Analytics
).build()
Qonversion.initialize(qonversionConfig)
}
}
import 'package:qonversion_flutter/qonversion_flutter.dart';
final config = new QonversionConfigBuilder(
'projectKey',
QLaunchMode.analytics
).build();
Qonversion.initialize(config);
import Qonversion, {
QonversionConfigBuilder,
LaunchMode,
} from 'react-native-qonversion';
const config = new QonversionConfigBuilder(
'projectKey',
LaunchMode.ANALYTICS
).build();
Qonversion.initialize(config);
using QonversionUnity;
private void Start()
{
QonversionConfig config = new QonversionConfigBuilder(
"projectKey",
LaunchMode.Analytics
).Build();
Qonversion.Initialize(config);
}
const config = new Qonversion.ConfigBuilder(
'projectKey',
Qonversion.LaunchMode.ANALYTICS,
).build();
Qonversion.initialize(config);
import Qonversion, {
QonversionConfigBuilder,
LaunchMode,
} from '@qonversion/capacitor-plugin';
const config = new QonversionConfigBuilder(
'projectKey',
LaunchMode.ANALYTICS
).build();
Qonversion.initialize(config);
→ Get your Qonversion Project Key
2. Sync Purchases
iOS, StoreKit 2
Subscriptions only
In case you're using StoreKit Version 1, we automatically handle all the needed data about transactions that occurred. However, in the case of StoreKit Version 2, it is necessary to leverage thesyncStoreKit2Purchases()
SDK method. Call this function every time you receive a successful purchase result or auto-renewed transaction.
// In case you're using CocoaPods:
QonversionSwift.shared.syncStoreKit2Purchases()
// In case you're using Swift Package Manager:
import QonversionSwift
QonversionSwift.shared.syncStoreKit2Purchases()
[[Qonversion sharedInstance] syncStoreKit2Purchases];
Qonversion.getSharedInstance().syncStoreKit2Purchases();
Qonversion.getSharedInstance().syncStoreKit2Purchases();
Qonversion.GetSharedInstance().SyncStoreKit2Purchases();
Qonversion.getSharedInstance().syncStoreKit2Purchases();
Qonversion.getSharedInstance().syncStoreKit2Purchases();
Subscriptions & Consumables
In case you're using StoreKit Version 2 and selling Subscriptions and Consumables we recommend using one of these methods before finishing transactions:
await QonversionSwift.shared.syncStoreKit2Transactions()
await QonversionSwift.shared.handleTransaction(transaction)
await QonversionSwift.shared.handleTransactions(transactions)
Android
-
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
-
While you are using Qonversion SDKs in Analytics Mode, in-app purchases implementation is entirely on your side. Remember 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.
-
Sync data with Qonversion in your current purchase flow. Call
syncPurchases()
after every purchase.
Qonversion.getSharedInstance().syncPurchases();
Qonversion.shared.syncPurchases()
Qonversion.getSharedInstance().syncPurchases();
Qonversion.getSharedInstance().syncPurchases();
Qonversion.GetSharedInstance().SyncPurchases();
Qonversion.getSharedInstance().syncPurchases();
Qonversion.getSharedInstance().syncPurchases();
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.
- Guide on Apple Server-to-Server Notifications
- Guide on Google Developer Notifications
4. Set additional user attributes
Optionally, to improve attribution in Adjust, AppsFlyer, Singular, or to match Qonversion revenue events to users in third-party tools, you can share with us such attributes as User Identifier, IDFA (Identifier for Advertisers, iOS 14.5+ only) or ASID (App set ID, Android 12+ only). Please, follow this guide to learn more.
Updated 22 days ago