With our Tenjin integration you can:

  • Accurately track subscriptions generated from Tenjin campaigns, allowing you to know precisely how much revenue your campaigns generate.

  • Send trial conversions and renewals directly from RevenueCat to Tenjin, allowing for tracking without an app open.

  • Continue to follow your cohorts for months to know the long tail revenue generated by your campaigns.

# 1. Send device data to RevenueCat

The Tenjin integration requires some device-specific data. RevenueCat will only send events into Tenjin if the below [Subscriber Attributes](πŸ”—ο»Ώ) keys have been set for the device.

KeyDescriptionRequired
`$idfa`iOS [advertising identifier](πŸ”—ο»Ώ) UUIDβœ… (iOS only)
`$gpsAdId`Google [advertising identifier](πŸ”—ο»Ώ)ο»Ώβœ… (Android only)
`$idfv`iOS [vender identifier](πŸ”—ο»Ώ) UUID❌ (optional)
`$androidId`Android [device identifier](πŸ”—ο»Ώ)❌ (optional)
`$ip`The IP address of the device❌ (optional)

These properties can be set manually, like any other [Subscriber Attributes](πŸ”—ο»Ώ), or through the helper method `collectDeviceIdentifiers()`.

ο»Ώ

You should make sure to call `collectDeviceIdentifiers()` after the _Purchases SDK_ is configured, and before the first purchase occurs. It's safe to call this multiple times, as only the new/updated values will be sent to RevenueCat.

Device identifiers with iOS App Tracking Transparency (iOS 14.5+)

If you are requesting the App Tracking permission through ATT to access the IDFA, you can call `.collectDeviceIdentifiers()` _again_ if the customer accepts the permission to update the `$idfa` attribute in RevenueCat.

Import AdSupport Framework (iOS)

The AdSupport framework is required to access the IDFA parameter on iOS. Don't forget to import this into your project.

ο»Ώ

## (Optional) Send campaign data to RevenueCat

RevenueCat itself is not an attribution network, and can't determine which specific ad drove an install/conversion. However, if you're able to collect this information from another source, such as Tenjin, it's possible to attach it to a user in RevenueCat using [Subscriber Attributes](πŸ”—ο»Ώ) as well. The below reserved key names can be used to optionally attach campaign data to a user. This data will then be sent through to other downstream analytics integrations and accessible via APIs and webhooks.

Key
`$mediaSource`
`$campaign`
`$adGroup`
`$ad`
`$keyword`
`$creative`

Remove SDK Purchase Tracking

Make sure to remove all client side tracking of revenue. Since RevenueCat will be sending events for all revenue actions, tracking purchases with the Tenjin SDK directly can lead to double counting of revenue in Tenjin.

# 2. Send RevenueCat events into Tenjin

After you've set up the _Purchases SDK_ to send attribution data from Tenjin to RevenueCat, you can "turn on" the integration and configure the event names from the RevenueCat dashboard.

  1. Navigate to your project in the RevenueCat dashboard and find the _Integrations_ card in the left menu. Select **+ New**

ο»Ώ

  1. Choose **Tenjin** from the integrations menu

  2. Add your Tenjin developer API key

  3. Select whether you want sales reported as gross revenue (before app store commission), or after store commission and/or estimated taxes.

Tenjin configuration screen
ο»Ώ

Tenjin configuration screen

About revenue discrepancies

RevenueCat must have the IDFA or ADID of the user at the time an event occurs in order to send it to Tenjin. This can result in drastically lower revenue metrics in Tenjin vs. RevenueCat since some users opt-out of ad tracking or don't have IDFA/ADID, which means some of your total revenue won't be tracked by Tenjin. Don't be alarmed! If events are being sent successfully in testing and for some of your users in production, then the integration is working as intended to pair subscription revenue with campaign performance.

You've done it!

You should start seeing events from RevenueCat appear in Tenjin. Woohoo!