Branch
With our Branch integration you can:
- Accurately track subscriptions generated from Branch campaigns, allowing you to know precisely how much revenue your campaigns generate.
- Send trial conversions and renewals directly from RevenueCat to Branch, allowing for tracking without an app open.
- Continue to follow your cohorts for months to know the long tail revenue generated by your campaigns.
Integration at a Glance
Includes Revenue | Supports Negative Revenue | Sends Sandbox Events | Includes Customer Attributes | Sends Transfer Events | Optional Event Types |
---|---|---|---|---|---|
✅ | ❌ | Requires test API key | ❌ | ❌ | non_subscription_purchase_event expiration_event product_change_event |
1. Set Branch user identity
In order to attach attribution data to the correct user, make sure the App User Ids for RevenueCat and Branch match. The easiest way to do this is to set the Branch SDK identity to match the Purchases App User Id whether you're providing your own ids or using our randomly generated ids.
(Optional) Set a separate identity in Branch and RevenueCat
If you prefer to keep a separate user identity between Branch and RevenueCat, set a $branchId
Attribute in RevenueCat. If set, RevenueCat will use this identifier for Branch events instead of the App User Id.
📘Install the Branch SDK
You will need to add the Branch SDK to your app before you can connect it with RevenueCat.
- Swift
- Obj-C
- Java
- React Native
// login
Branch.getInstance().setIdentity("my_app_user_id")
// Optional: Use a different App User ID between Branch and RevenueCat
Purchases.shared.attribution.setAttributes(["$branchId": "<custom_branch_user_id"])
// logout
Branch.getInstance().logout()
// login
[[Branch getInstance] setIdentity:@"my_app_user_id"];
// logout
[[Branch getInstance] logout];
// login
Branch.getInstance().setIdentity("my_app_user_id");
// logout
Branch.getInstance().logout();
// login
branch.setIdentity("my_app_user_id")
// logout
branch.logout()
2. Send device data to RevenueCat
The Branch integration accepts some device-specific data that can be sent to RevenueCat through reserved Attribute keys.
Key | Description | Required |
---|---|---|
$idfa | iOS advertising identifier UUID | ✅ (required) if no $idfv |
$idfv | iOS vender identifier UUID |