Skip to main content
7 min read

How to Add Affiliate Tracking to Your Superwall App

Connect Superwall to Appfiliate for automatic affiliate attribution on paywall conversions. Track which creators drive subscriptions through your Superwall paywalls.

A
Appfiliate
How to Add Affiliate Tracking to Your Superwall App

Superwall makes it easy to build, test, and optimize paywalls. It handles the presentation layer well. But when a creator drives an install that converts through one of your Superwall paywalls, you have no idea which creator deserves the credit.

That is the gap. Superwall tells you which paywall variant converted. Appfiliate tells you which creator sent the user in the first place. Connect the two, and you can see that Creator A drove 200 installs last month, 38 of which hit your paywall and 14 converted to paid subscribers. That is the data you need to run a real Superwall affiliate integration.

This guide walks through connecting Superwall to Appfiliate so that every paywall conversion is automatically attributed to the creator who drove the install. The integration takes about fifteen minutes and requires no IDFA, no ATT prompt, and no manual purchase tracking code.

How the integration works

The flow is straightforward:

    • A creator shares their unique Appfiliate link.
    • A user clicks the link and installs your app.
    • The Appfiliate SDK matches the link click to the install using device signals (no IDFA required).
    • When the user subscribes through a Superwall paywall, Superwall fires a webhook to Appfiliate.
    • Appfiliate matches the subscription event to the original creator using the user ID you set in code.
The result: every subscription, renewal, and cancellation that flows through Superwall is automatically attributed to the correct creator. No trackPurchase() calls in your code. No manual reconciliation. The webhook handles everything.

Step 1: Add the Appfiliate SDK

First, add the Appfiliate SDK to your project. Pick the tab that matches your platform.

iOS (Swift)

Add the Swift Package in Xcode:

    • Go to File > Add Package Dependencies
    • Paste the repository URL: https://github.com/Appfiliate-sdk/appfiliate-ios-sdk
    • Select version 1.0.0 or later
    • Click Add Package

Android (Kotlin)

Add JitPack to your settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

Then add the dependency to your app's build.gradle.kts:

dependencies {
    implementation("com.github.Appfiliate-sdk:appfiliate-android-sdk:1.0.0")
}

Flutter (Dart)

Add to your pubspec.yaml:

dependencies:
  appfiliate: ^1.0.0

Run flutter pub get.

React Native

npm install appfiliate-react-native

Step 2: Initialize the SDK and set the user ID

This is the critical step. You need to do two things on app launch: track the install and link the user to their Superwall identity. The user ID is what connects the install attribution to the webhook events that Superwall sends later.

iOS (Swift)

import Appfiliate
import SuperwallKit

// In your App init() or AppDelegate didFinishLaunchingWithOptions:
Appfiliate.configure(appId: "APP_ID_HERE", apiKey: "API_KEY_HERE")
Appfiliate.trackInstall()
Appfiliate.setUserId(Superwall.shared.userId)

Android (Kotlin)

import com.appfiliate.sdk.Appfiliate
import com.superwall.sdk.Superwall

// In Application.onCreate() or main Activity.onCreate():
Appfiliate.configure(this, appId = "APP_ID_HERE", apiKey = "API_KEY_HERE")
Appfiliate.trackInstall(this)
Appfiliate.setUserId(this, Superwall.instance.userId)

Flutter (Dart)

import 'package:appfiliate/appfiliate.dart';

// In main() or initState():
Appfiliate.configure(appId: 'APP_ID_HERE', apiKey: 'API_KEY_HERE');
await Appfiliate.trackInstall();
await Appfiliate.setUserId(Superwall.shared.userId);

React Native

import { appfiliate } from 'appfiliate-react-native';

// On app startup:
appfiliate.configure({ appId: 'APP_ID_HERE', apiKey: 'API_KEY_HERE' });
await appfiliate.trackInstall();
await appfiliate.setUserId(Superwall.shared.userId);

Replace APP_ID_HERE and API_KEY_HERE with the credentials from your Appfiliate dashboard. You can find these under your app's settings.

A few things to note:

  • trackInstall() only fires once per install. It is safe to call on every app launch.
  • setUserId() links the Superwall user identity to the Appfiliate attribution record. This is what allows the webhook to match subscription events to the correct creator.
  • If you are using RevenueCat alongside Superwall, you can use either the Superwall user ID or the RevenueCat appUserID. Just be consistent with what Superwall sends in the webhook payload.

Step 3: Add the webhook URL in Superwall

This is where the automation happens. Instead of calling trackPurchase() in your code every time a user subscribes, Superwall sends the event data directly to Appfiliate via webhook.

https://us-central1-appfiliate-5a18b.cloudfunctions.net/api/v1/webhooks/superwall?secret=YOUR_WEBHOOK_SECRET

Replace YOUR_WEBHOOK_SECRET with the webhook secret from your Appfiliate dashboard. You can find it under Settings > Integrations > Superwall.

That is the entire integration. Three lines of code in your app, one URL in the Superwall dashboard.

What events are tracked

Once the webhook is connected, Appfiliate automatically processes the following Superwall events:

  • New subscriptions, when a user converts through a Superwall paywall, the subscription is attributed to the creator who drove the install.
  • Renewals, recurring payments are tracked and attributed to the original creator, so you can see lifetime revenue per creator, not just the initial conversion.
  • Cancellations, when a subscriber churns, the cancellation is recorded against the creator's attribution record. This helps you identify which creators drive high-quality, long-retention subscribers versus those who drive users that cancel quickly.
All of this happens server-side through the webhook. There is no additional client-side code required beyond the three lines in Step 2.

Why this matters for your creator program

If you are running Superwall, you are already investing in paywall optimization. You are experimenting with paywalls, tweaking prices, doing A/B tests. But what about acquisition? What are your best subscribers made of?

With Superwall integrated as an affiliate source in Appfiliate, you can answer questions like:

  • Which creators generate the most paywall conversions (not just app installs)?
  • What is the revenue per creator for the past 30, 60, or 90 days?
  • Which creators generate subscribers with the highest LTV?
  • Which creators perform best on which paywall variant?
This information makes your relationships with creators data driven. You can pay them according to the revenue they actually bring, find more creators like the ones performing best for you, and cut the creators that only drive installs but not paywall conversions.

Check our pricing page for plan details or browse other integrations if you use other subscription platforms besides Superwall.

FAQ

Do I need to call trackPurchase() in my code? No. The Webhook takes care of purchase tracking for you. You still only need the 3 lines of code from Step 2: configure, trackInstall, and setUserId. The Webhook will handle the rest (subscriptions, renewals, cancellations, etc). Does this integration require IDFA or ATT prompt? No. The Appfiliate SDK relies on device signals (device model, OS version, locale, timezone) to match link clicks with installs. No IDFA, no ATT prompt. Your users will never be prompted for tracking permissions. I also use RevenueCat with Superwall. Which integration should I use? You can use either. If you rely on RevenueCat for managing your subscription state, please connect the RevenueCat Webhook instead. If your subscription state is managed directly in Superwall, please use the Superwall Webhook. Do not connect both for the same events, as this will result in duplicate records. What should I pass as user ID to the setUserId() function? Please use the same user ID that Superwall sends in their Webhook payload. This is typically the Superwall user ID (Superwall.shared.userId). If you have set a custom user identity with Superwall, please use that instead. What matters is that the user ID you pass from your app matches the user ID you see in the Webhook payload. How long does it take for Webhook events to show up in the dashboard? Webhook events are processed in real time. When a user purchases a subscription from a Superwall paywall, you should see the attribution in your Appfiliate dashboard within seconds. I am new to Appfiliate. Where should I start? Please start by visiting appfiliate.io to create your account. It only takes a few minutes to set up. Once you have your app ID and API key, please return to these steps.