Client SDKs

RevenueCat Integration

Connect Audiencelab and RevenueCat so subscription purchases attribute to the Audiencelab install

Use this guide when your iOS app uses both the Audiencelab SDK and RevenueCat. Audiencelab joins RevenueCat purchase and renewal webhooks to the original install using a shared device id.

Requires Audiencelab iOS SDK 1.1.14 or later.

What you set up

  1. Audiencelab SDK initialized in the app
  2. RevenueCat Purchases SDK configured in the app
  3. getRevenueCatAttributes() copied onto the RevenueCat subscriber before the first paywall
  4. RevenueCat connected in the Audiencelab dashboard (webhook URL + signing secret)
  5. That webhook configured in the RevenueCat project

You do not need to call sendPurchaseEvent for RevenueCat-managed subscriptions. Renewals can attribute even when the app is closed.

1. Install and initialize

Install Audiencelab as usual (Installation) and initialize before any RevenueCat paywall:

import AudienceLabSDK
import RevenueCat

AudienceLabSDK.initialize(
    apiKey: "YOUR_AUDIENCELAB_API_KEY",
    options: AudienceLabOptions(
        isDevelopmentMode: false,
        isDebugEnabled: false
    )
)

Purchases.configure(withAPIKey: "YOUR_REVENUECAT_API_KEY")

Open the app at least once with a valid creative token path so Audiencelab can store device identity for later joins.

2. Pass Audiencelab identity into RevenueCat

After both SDKs are ready, and before the first paywall, copy Audiencelab's device id onto the RevenueCat subscriber. Safe to call on every cold start:

Purchases.shared.attribution.setAttributes(
    AudienceLabSDK.getRevenueCatAttributes()
)

getRevenueCatAttributes() returns a string map with:

KeyValue
audienceLabIdiOS Identifier for Vendor (ifv), when available

Empty values are omitted. There is no RevenueCat SDK dependency inside Audiencelab; your app calls RevenueCat's setAttributes with the map Audiencelab returns.

Custom RevenueCat attribute keys must not start with $. audienceLabId is intentional.

3. Connect RevenueCat in the Audiencelab dashboard

In Audiencelab, open the app's integrations / data sources flow and connect RevenueCat:

  1. Enter your RevenueCat project id
  2. Save
  3. Copy the webhook URL and signing secret immediately (the secret is shown once)

Keep both values for the next step.

4. Add the webhook in RevenueCat

In the RevenueCat dashboard for that project:

  1. Open IntegrationsWebhooks
  2. Add a webhook using the Audiencelab webhook URL
  3. Paste the Audiencelab signing secret as the webhook authorization / signing secret
  4. Enable at least:
    • INITIAL_PURCHASE
    • RENEWAL
    • NON_RENEWING_PURCHASE

Other event types can stay enabled; Audiencelab acknowledges them and skips ingest for v1.

5. Verify

  1. Cold-open the app so getRevenueCatAttributes() runs after both SDKs initialize
  2. Complete a sandbox purchase or trial conversion (converting with the app closed is the strongest test)
  3. Confirm the purchase appears in Audiencelab attributed to the install creative

Notes

  • Device-local total_purchase_value only updates from sendPurchaseEvent. RevenueCat webhook purchases are recorded server-side and do not bump on-device cumulative totals.
  • Do not rely on RevenueCat $idfv alone for the join. Always call getRevenueCatAttributes() so audienceLabId is present on later webhooks.