How to Add Affiliate Tracking to Your RevenueCat App
Set up automatic affiliate attribution for RevenueCat apps. Track which creators drive subscriptions, renewals, and revenue with Appfiliate's webhook integration.

RevenueCat handles your subscriptions. It manages entitlements, processes renewals, tracks MRR, and gives you a clean dashboard for all of your subscription metrics. What it doesn’t do is tell you which creator or affiliate drove each subscriber.
A creator posts a TikTok about your app. Fifty people install it. Eight of them subscribe. RevenueCat will show you those eight new subscribers. But it won’t tell you that all eight came from that one creator. And without that data, you can’t pay the creator, you can’t measure their ROI, and you can’t scale what’s working.
RevenueCat affiliate tracking is the missing piece. This guide walks through connecting Appfiliate to RevenueCat so that every subscription, renewal, and cancellation is automatically attributed to the creator who drove the install. The setup takes about fifteen minutes and requires three lines of code plus a webhook URL.
How it works
The integration has three parts:
- The Appfiliate SDK tracks the install and connects it to the creator’s referral link. This happens at the device level using standard device signals. No IDFA, no ATT prompt.
- Your app calls setUserId with the RevenueCat app user ID. This links the anonymous install attribution to a specific RevenueCat subscriber.
- RevenueCat sends webhook events (new subscription, renewal, cancellation) to Appfiliate. Appfiliate matches the RevenueCat user ID to the original creator attribution and records the revenue.
Step 1: Add the Appfiliate SDK
First, add the Appfiliate SDK to your app. The SDK is lightweight, has zero dependencies (except Install Referrer on Android), and works across all four major platforms.
Pick your platform:
iOS (Swift)Add the Swift Package in Xcode: File > Add Package Dependencies, then paste https://github.com/Appfiliate-sdk/appfiliate-ios-sdk and select version 1.0.0 or later.
Add JitPack to your repositories, then add the dependency to your app’s build.gradle.kts:
implementation("com.github.Appfiliate-sdk:appfiliate-android-sdk:1.0.0")
Flutter (Dart)
Add to pubspec.yaml:
dependencies:
appfiliate: ^1.0.0
Then run flutter pub get.
npm install appfiliate-react-native
Step 2: Configure the SDK and link the RevenueCat user ID
This is the core of the integration. You need three calls: to initialize the SDK, to record the install attribution, and to link the install to the RevenueCat subscriber.
Here are the full code examples for each platform.
iOS (Swift)import Appfiliate
import RevenueCat
// In your App.init() or AppDelegate.didFinishLaunchingWithOptions:
Appfiliate.configure(appId: "APP_ID_HERE", apiKey: "API_KEY_HERE")
Appfiliate.trackInstall()
Appfiliate.setUserId(Purchases.shared.appUserID)
Android (Kotlin)
import com.appfiliate.sdk.Appfiliate
import com.revenuecat.purchases.Purchases
// In Application.onCreate() or main Activity.onCreate():
Appfiliate.configure(this, appId = "APP_ID_HERE", apiKey = "API_KEY_HERE")
Appfiliate.trackInstall(this)
Appfiliate.setUserId(this, Purchases.sharedInstance.appUserID)
Flutter (Dart)
import 'package:appfiliate/appfiliate.dart';
import 'package:purchases_flutter/purchases_flutter.dart';
// In main() or initState():
Appfiliate.configure(appId: 'APP_ID_HERE', apiKey: 'API_KEY_HERE');
await Appfiliate.trackInstall();
await Appfiliate.setUserId(await Purchases.appUserID);
React Native (TypeScript)
import { appfiliate } from 'appfiliate-react-native';
import Purchases from 'react-native-purchases';
// On app startup:
appfiliate.configure({ appId: 'APP_ID_HERE', apiKey: 'API_KEY_HERE' });
await appfiliate.trackInstall();
await appfiliate.setUserId(await Purchases.getAppUserID());
Replace APP_ID_HERE and API_KEY_HERE with your credentials from the Appfiliate dashboard. They are found under your app settings.
trackInstall()fires only once per install. It's safe to call it on every app launch.- Call
setUserIdonce you've configured RevenueCat and have the user ID available. If you're using anonymous IDs from RevenueCat, this works out of the box. If you're using custom IDs withlogIn(), call this after the login has completed successfully. - The order of operations is important. Configure first, track the install second, then set the user ID.
Add the webhook URL in RevenueCat
This is where the magic happens. Instead of calling trackPurchase() in your app for every purchase, RevenueCat sends purchase events to Appfiliate via a webhook.
- Go to your RevenueCat dashboard and log in.
- Select your project, then go to Integrations > Webhooks.
- Add this webhook URL:
https://us-central1-appfiliate-5a18b.cloudfunctions.net/api/v1/webhooks/revenuecat?secret=YOUR_WEBHOOK_SECRET
Replace YOUR_WEBHOOK_SECRET with your webhook secret from the Appfiliate dashboard. You can find it under your app's integration settings.
- Save your webhook configuration.
What purchase events are tracked
Once you've connected the webhook, Appfiliate receives and processes these RevenueCat events:
- Subscription started. A user subscribes for the first time. Appfiliate records the revenue and attributes it to the creator who drove the install.
- Subscription renewed. The subscription renews at the end of the billing period. The renewal revenue is attributed to the same creator. This is where revenue share gets interesting for subscription apps, because a single install keeps generating attributed revenue month after month.
- Subscription cancelled. The user cancels. Appfiliate marks the subscription as churned so your revenue metrics stay accurate.
Why use a webhook instead of tracking purchases manually
You can also call trackPurchase() in your app for every purchase event, and skip the webhook. But for RevenueCat apps, using a webhook is better for three reasons:
- Renewing purchases. If you use
trackPurchase(), you can only track new purchases. Renewals happen in the background when your app isn't open, so you'll miss those. The webhook tracks every renewal, because RevenueCat handles renewals server-side. - Less code to maintain. Three lines of SDK code and a webhook URL is the entire integration.
- Server-side reliability. Webhook delivery is retried on failure. Client-side attribution can fail if the app crashes, the user force-quit the app, or the device is offline at purchase time.
What you see in the dashboard
Once you have the integration running, you will see in your Appfiliate dashboard:
- Which creator drove which subscribers
- Total subscription revenue per creator (first purchase + renewals)
- Active vs. churned subscribers per creator
- Revenue share owed to each creator based on your rules
Frequently asked questions
Do I still need to call trackPurchase() if I'm using the webhook?No. The webhook takes care of all purchase and renewal attribution for you. You only need to implement configure, trackInstall, and setUserId in your app.
What if I use custom RevenueCat user IDs instead of anonymous IDs?No problem. Just make sure you pass the same user ID to setUserId that you pass to RevenueCat. If you call Purchases.logIn(customId), pass that same customId to Appfiliate.setUserId.
Does this work with RevenueCat's Offerings and Paywalls?Yes. The webhook integration is decoupled from your paywall implementation. Whether you use RevenueCat's native paywall, a custom paywall, or Offerings, the subscription events are sent through the same webhook.
What about free trials that convert to paid subscriptions?When a free trial converts to a paid subscription, RevenueCat sends a new subscription event. Appfiliate attributes that subscription to the creator who drove the original install.
Can I use this alongside other RevenueCat webhooks?Yes. RevenueCat allows multiple webhook endpoints to be configured. Adding the Appfiliate webhook does not interfere with any other integration you may have set up.
How much does this cost?Appfiliate offers a free plan for apps that are just getting started with creator marketing. For more information, see our pricing page.
Does the SDK require any special permissions?No. The Appfiliate SDK does not use IDFA, does not trigger the ATT prompt, and does not require any other special permissions on any platform. Attribution works using standard device signals.
Next steps
If you're already integrated with RevenueCat and working with creators, this gives you the data infrastructure you've been missing. Once you set it up, every new subscription is automatically attributed to the right creator.
Head over to our integrations page to see other subscription providers we support, including Superwall, Adapty, Qonversion, and Stripe. The integration pattern is the same: SDK + webhook, and you get full revenue attribution without having to manually track purchases.