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 and AL secret)
- That webhook configured in the RevenueCat project with the AL secret from the connect dialog
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 the AL secret from the connect dialog
The webhook URL looks like https://analytics.geeklab.app/webhooks/revenuecat. The AL secret is the same value as the app API key (returned as al_secret).
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 AL secret from the Audiencelab connect dialog into RevenueCat's Authorization header value field. Prefer
Bearer <al_secret>; the raw AL secret is also accepted. Do not enable HMAC webhook signing. - Set the environment to Production only
- 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 Production store purchase or trial conversion through a Production RevenueCat webhook (converting with the app closed is the strongest test)
- Confirm the purchase appears in Audiencelab attributed to the install creative
Notes
- Audiencelab ignores RevenueCat Sandbox environment events. Configure the webhook for Production only.
- 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().