Client SDKs
RevenueCat Integration
Connect Audiencelab and RevenueCat so subscription purchases attribute to the Audiencelab install
Use this guide when your Android 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 Android SDK 1.1.11 or later.
What you set up
- Audiencelab SDK initialized in the app
- RevenueCat Purchases SDK configured in the app
getRevenueCatAttributes()copied onto the RevenueCat subscriber before the first paywall- RevenueCat connected in the Audiencelab dashboard (webhook URL + signing secret)
- 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 app.geeklab.audiencelab.sdk.AudienceLabOptions
import app.geeklab.audiencelab.sdk.AudienceLabSDK
import com.revenuecat.purchases.Purchases
import com.revenuecat.purchases.PurchasesConfiguration
AudienceLabSDK.initialize(
context = applicationContext,
apiKey = BuildConfig.AUDIENCELAB_API_KEY,
options = AudienceLabOptions(
isDevelopmentMode = BuildConfig.DEBUG,
isDebugEnabled = BuildConfig.DEBUG,
autoResolveGooglePlayIds = true
)
)
Purchases.configure(
PurchasesConfiguration.Builder(this, "YOUR_REVENUECAT_API_KEY").build()
)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.sharedInstance.setAttributes(
AudienceLabSDK.getRevenueCatAttributes()
)getRevenueCatAttributes() returns a string map with:
| Key | Value |
|---|---|
audienceLabId | Google Advertising ID (ga), else App Set ID (asid), else Android ID (aid). All-zero GAID is treated as missing. |
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:
- Enter your RevenueCat project id
- Save
- 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:
- Open Integrations → Webhooks
- Add a webhook using the Audiencelab webhook URL
- Paste the Audiencelab signing secret as the webhook authorization / signing secret
- Enable at least:
INITIAL_PURCHASERENEWALNON_RENEWING_PURCHASE
Other event types can stay enabled; Audiencelab acknowledges them and skips ingest for v1.
5. Verify
- Cold-open the app so
getRevenueCatAttributes()runs after both SDKs initialize - Complete a sandbox purchase or trial conversion (converting with the app closed is the strongest test)
- Confirm the purchase appears in Audiencelab attributed to the install creative
Notes
- Device-local
total_purchase_valueonly updates fromsendPurchaseEvent. RevenueCat webhook purchases are recorded server-side and do not bump on-device cumulative totals. - Do not rely on RevenueCat
$gpsAdIdalone for the join. Always callgetRevenueCatAttributes()soaudienceLabIdis present on later webhooks. - If Google Play ID lookup can stall in restricted networks, use
autoResolveGooglePlayIds = falseand supply identity through the documented setters or providers before callinggetRevenueCatAttributes().