Airship

Integrate in-app purchase events from RevenueCat with Airship

👍

The Airship integration is available on the Pro plan.

RevenueCat can automatically send subscription events to Airship. This can be helpful in understanding what stage a customer is in to react accordingly.

Use your RevenueCat events to send Custom Events to trigger messages with Airship. This means you can design personalized Airship Journeys and Automations based on purchase behavior. For example, you might want to:

  • Send a message to a user whose subscription experienced a billing issue.
  • Send reminders to your app's message center when a user's trial is about to expire.

With accurate and up-to-date subscription data in Airship, you'll be set to increase your users' engagement.

Events

The Airship integration tracks the following events:

Event TypeEvent NameDescription
Initial PurchaseRevenueCat_initial_purchase_eventThe first purchase of an auto-renewing subscription product that does not contain a free trial.
Trial StartedRevenueCat_trial_started_eventThe start of an auto-renewing subscription product free trial.
Trial ConvertedRevenueCat_trial_converted_eventWhen an auto-renewing subscription product converts from a free trial to normal paid period.
Trial CancelledRevenueCat_trial_cancelled_eventWhen a user turns off renewals for an auto-renewing subscription product during a free trial period.
RenewalRevenueCat_renewal_eventWhen an auto-renewing subscription product renews OR a user repurchases the auto-renewing subscription product after a lapse in their subscription.
CancellationRevenueCat_cancellation_eventWhen a user turns off renewals for an auto-renewing subscription product during the normal paid period.
UncancellationRevenueCat_uncancellation_eventWhen a user re-enables the auto-renew status for a subscription.
Non Subscription PurchaseRevenueCat_non_subscription_purchase_eventThe purchase of any product that's not an auto-renewing subscription.
Subscription PausedRevenueCat_subscription_paused_eventWhen a subscription is paused. Available for Google Play subscriptions only.
ExpirationRevenueCat_expiration_eventWhen a subscription expires.
Billing IssueRevenueCat_billing_issue_eventWhen a billing issue is detected.

For events that have revenue, such as trial conversions and renewals, RevenueCat will automatically record this amount along with the event in Airship.

Setup

1. Set Airship User Identity

If you're using the Airship SDK, you can either send the channel ID to RevenueCat or set an Airship Named User to match the RevenueCat app user ID. The preferred method is to send the channel ID to RevenueCat. Either method you use will allow events sent from the Airship SDK and events sent from RevenueCat to be synced to the same user.

Set Airship User Identity Using Channel ID

Setting the Airship channel ID in RevenueCat is the preferred way for identifying users in Airship. Call setAirshipChannelID on the Purchases SDK to have RevenueCat use the channel ID to send events to Airship.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

  // Configure Purchases
  Purchases.configure(withAPIKey: "public_sdk_key", appUserID: "my_app_user_id")
  
  // Initialize Airship
  Airship.takeOff(launchOptions: launchOptions)
  
  // Set the Airship channel ID in Purchases
  let channelID = Airship.channel.identifier
  Purchases.shared.setAirshipChannelID(channelID)
  
  // ...

  return true
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  // Configure Purchases
  [RCPurchases configureWithAPIKey:@"public_sdk_key" appUserID:@"my_app_user_id"];

  // Initialize Airship
  [UAirship takeOffWithLaunchOptions:launchOptions];
  
  // Set the Airship channel ID in Purchases
  NSString *channelID = UAirship.channel.identifier;
  [[RCPurchases sharedPurchases] setAirshipChannelID:channelID];
  
  // ...

  return YES;
}
override fun onCreate(savedInstanceState: Bundle?) {

  super.onCreate(savedInstanceState)

  // Configure Purchases SDK
  Purchases.configure(this, "public_sdk_key", "my_app_user_id")

  // Airship should already be initialized using Autopilot
  // https://docs.airship.com/platform/android/getting-started/#takeoff

  // Set the Airship channel ID in Purchases
  val channelId = UAirship.shared().channel.id
  Purchases.sharedInstance.setAirshipChannelID(channelId)

  // ...
}
@Override
public void onCreate(Bundle savedInstanceState) {
  
  super.onCreate(savedInstanceState);

  // Configure Purchases SDK
  Purchases.configure(this, "public_sdk_key", "my_app_user_id");

  // Airship should already be initialized using Autopilot
  // https://docs.airship.com/platform/android/getting-started/#takeoff

  // Set the Airship channel ID in Purchases
  String channelId = UAirship.shared().getChannel().getId();
  Purchases.getSharedInstance().setAirshipChannelID(channelId);

  // ...
}

[Advanced Alternative] Set Airship User Identity Using Named Users

Setting the Airship channel ID in RevenueCat is preferred over using Named Users, even if you have a user authentication system. However, if you're already using Named Users in your Airship integration, you have the option to set the Named User in the Airship SDK as the same app user ID as RevenueCat. Ensure Named Users is enabled in your Airship dashboard.

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

  // Configure Purchases
  Purchases.configure(withAPIKey: "public_sdk_key", appUserID: "my_app_user_id")
  
  // Initialize Airship
  Airship.takeOff(launchOptions: launchOptions)
  
  // Identify the user in Airship
  Airship.contact.identify("my_app_user_id")
  
  // ...

  return true
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  // Configure Purchases
  [RCPurchases configureWithAPIKey:@"public_sdk_key" appUserID:@"my_app_user_id"];

  // Initialize Airship
  [UAirship takeOffWithLaunchOptions:launchOptions];
  
  // Identify the user in Airship
  [UAirship.contact identify:@"my_app_user_id"];
  
  // ...

  return YES;
}
override fun onCreate(savedInstanceState: Bundle?) {

  super.onCreate(savedInstanceState)

  // Configure Purchases SDK
  Purchases.configure(this, "public_sdk_key", "my_app_user_id")

  // Airship should already be initialized using Autopilot
  // https://docs.airship.com/platform/android/getting-started/#takeoff

  // Set the Airship channel ID in Purchases
  UAirship.shared().contact.identify("my_app_user_id")

  // ...
}
@Override
public void onCreate(Bundle savedInstanceState) {
  
  super.onCreate(savedInstanceState);

  // Configure Purchases SDK
  Purchases.configure(this, "public_sdk_key", "my_app_user_id");

  // Airship should already be initialized using Autopilot
  // https://docs.airship.com/platform/android/getting-started/#takeoff

  // Identify the user in Airship
  UAirship.shared().getContact().identify("my_app_user_id");

  // ...
}

2. Send RevenueCat Events to Airship

After you've set up the Purchase SDK and Airship SDK to have the same user identity, you can "turn on" the integration and configure the event names from the RevenueCat dashboard.

  1. Navigate to your app in the RevenueCat dashboard and choose 'Airship' from the integrations menu
  2. Add your Airship app key and token
  3. Select the location of your Airship cloud site
  4. Enter the event names that RevenueCat will send or choose the default event names
  5. Select whether you want RevenueCat to report proceeds (after app store cut) or revenue (gross sales)
15401540

Airship configuration page

Sample Event

Below is sample JSON that is delivered to Airship for a renewal event.

[
    {
        "occurred": "2021-09-27T15:31:38Z",
        "user": {
            "channel": "2ceefb74-f116-49c8-601a-b36ad6ba42d4"
        },
        "body": {
            "name": "renewal_event",
            "value": 4.503,
            "properties": {
                "id": "2F4B1128-CF82-4192-AEB9-9B475393D1A2",
                "event_timestamp_ms": 1632756861708,
                "app_user_id": "$RCAnonymousID:281d3889d2aea5579f406bc1f285021f",
                "aliases": [
                    "$RCAnonymousID:281d3889d2aea5579f406bc1f285021f"
                ],
                "original_app_user_id": "$RCAnonymousID:281d3889d2aea5579f406bc1f285021f",
                "product_id": "com.my.app.monthly_4.99.1_week_intro",
                "period_type": "NORMAL",
                "purchased_at_ms": 1632756698000,
                "expiration_at_ms": 1632756998000,
                "environment": "PRODUCTION",
                "entitlement_ids": [
                    "pro"
                ],
                "presented_offering_id": "default",
                "transaction_id": "1000000881883259",
                "original_transaction_id": "1000000884174114",
                "is_family_share": false,
                "country_code": "ES",
                "currency": "EUR",
                "is_trial_conversion": false,
                "price_in_purchased_currency": 5.49,
                "subscriber_attributes": {
                    "$ip": {
                        "value": "53.126.228.862",
                        "updated_at_ms": 1632755230679
                    },
                    "$idfv": {
                        "value": "D0860044-2AFE-7B5E-8175-284C3E46F0C1",
                        "updated_at_ms": 1632755230678
                    },
                    "$airshipChannelId": {
                        "value": "2ceefb74-f116-49c8-601a-b36ad6ba42d4",
                        "updated_at_ms": 1632756877789
                    }
                },
                "store": "APP_STORE",
                "takehome_percentage": 0.7
            }
        }
    }
]