Observer Mode

Learn how to use Adapty iOS SDK in Observer mode along with existing purchase infrastructure

If you have a functioning subscription system and want to give Adapty SDK a quick try, you can use Observer mode. With just one line of code you can:

Adapty SDK will automatically collect all transactions and will be sending subscription events. To turn on Observer mode, just set observerMode to true when activating Adapty:

Adapty.activate("PUBLIC_SDK_KEY", customerUserId: "YOUR_USER_ID", observerMode: true)

🚧

When running in Observer mode, Adapty SDK won't close any transactions, so make sure you're handling it.

A/B tests analytics

In Observer mode, Adapty SDK doesn't know, where the purchase was made from. If you display products using our Paywalls or A/B Tests, you can manually assign variation to the purchase. After doing this, you'll be able to see metrics in Adapty Dashboard.

let transactionId = transaction.transactionIdentifier
let variationId = paywall.variationId

Adapty.setVariationId(variationId, forTransactionId: transactionId) { (error) in
    if error == nil {
        // successful binding
    }
}

Request parameters:

  • Variation Id (required): a string identifier of variation. You can get it using variationId property of PaywallModel.
  • Transaction Id (required): a string identifier (transactionIdentifier) of your purchased transaction SKPaymentTransaction.

Did this page help you?