AppsFlyer

This guide describes how to add and configure AppsFlyer integration.

AppsFlyer is the world's leading mobile attribution & marketing analytics platform, helping app marketers around the world make better decisions.

How does Integration Work?

This integration works in two ways.

1. Receive Attribution Data from AppsFlyer

Once you successfully configured AppsFlyer integration, Apphud will receive attribution data from it. You can view this data on user's page:

2. Send Subscription Events to AppsFlyer

Apphud can also send all subscription events to AppsFlyer. So you could view these events in AppsFlyer dashboard and AppsFlyer could pass this data to their partners. This will help to measure efficiency of your ad campaigns.

How to Add Integration?

Step 1
2
3
4
5
6
7
8
✅ 9
Step 1
  • Integrate AppsFlyer SDK into your iOS app;

  • Implement the following AppsFlyerTrackerDelegate method:

// in AppsFlyer SDK v5.0 or higher:
func onConversionDataSuccess(_ conversionInfo: [AnyHashable : Any]!) {
Apphud.addAttribution(data: conversionInfo, from: .appsFlyer, identifer: AppsFlyerTracker.shared()?.getAppsFlyerUID()) { _ in }
}
func onConversionDataFail(_ error: Error!) {
}
// in lower versions of AppsFlyer SDK:
func onConversionDataReceived(_ installData: [AnyHashable: Any]) {
Apphud.addAttribution(data: installData, from: .appsFlyer, identifer: AppsFlyerTracker.shared()?.getAppsFlyerUID(), callback: nil)
}
2

Open AppsFlyer and sign in.

3

Go to "App Settings" and copy Dev Key

You should use SDK Dev key, not Pull API key.

4

At Apphud go to "Integrations" section and add AppsFlyer:

5

Paste AppsFlyer Dev Key into "Developer key" field:

6

You may have one more app created in AppsFlyer used for testing purposes not to mix test and live data. If you have such app, paste AppsFlyer test App Store app ID into "Test App Store app ID key" field.

Information about how to create app for debug purposes can be found in AppsFlyer documentation.

All subscription events will be sent using this test key if setIntegrationsTestMode() is called in Apphud SDK. Read more here.

7

You can enter your custom event names or disable some.

You can use AppsFlyer built-in rich events names. View more information here.

From AppsFlyer help: each network has its own limitations regarding the permitted characters in event names. To avoid problems, use only lower-case alpha-numeric characters (a-z and 0-9) for your in-app event names.

8

Enable integration:

✅ 9

Save changes:

While configuring integration you can also choose between sending revenue as sales or proceeds (without Apple 15%-30% commission).

You can read more how Apple calculates commission here.

In order to receive AppsFlyer attribution data from Facebook, you should accept Facebook’s "Advanced Mobile Measurement Agreement" using this link.

Events Cheat Sheet

This is a list of all possible events and their parameters that are being sent to AppsFlyer.

You can read more about subscription events here and parameters here.

Trial
Introductory Offer
Regular
Promo Offer
Autorenew
Trial

Trial period started

Default event name: apphud_trial_started

Parameters:

  • af_content_id: String

  • unit: String

  • units_count: Integer

Successful conversion from trial period to regular subscription

Default event name: apphud_trial_converted

Parameters:

  • af_content_id: String

  • af_revenue: Float

  • af_currency: String

Failed conversion from trial period to regular subscription

Default event name: apphud_trial_expired

Parameters:

  • af_content_id: String

  • reason: String

Introductory Offer

Introductory offer started

Default event name: apphud_intro_started

Parameters:

  • af_content_id: String

  • af_revenue: Float

  • af_currency: String

  • offer_type: String

  • unit: String

  • units_count: Integer

Introductory offer renewed

Default event name: apphud_intro_renewed

Parameters:

  • af_content_id: String

  • af_revenue: Float

  • af_currency: String

  • offer_type: String

  • unit: String

  • units_count: Integer

Successful conversion from introductory offer to regular subscription

Default event name: apphud_intro_converted

Parameters:

  • af_content_id: String

  • af_revenue: Float

  • af_currency: String

  • offer_type: String

Failed conversion from introductory offer to regular subscription or failed renew

Default event name: apphud_intro_expired

Parameters:

  • af_content_id: String

  • reason: String

  • offer_type: String

Refund during introductory offer

Default event name: apphud_intro_refunded

Parameters:

  • af_content_id: String

  • af_revenue: Float

  • af_currency: String

  • reason: String

  • offer_type: String

Regular

Subscription started

Default event name: apphud_subscription_started

Parameters:

  • af_content_id: String

  • af_revenue: Float

  • af_currency: String

Subscription renewed

Default event name: apphud_subscription_renewed

Parameters:

  • af_content_id: String

  • af_revenue: Float

  • af_currency: String

Subscription expired

Default event name: apphud_subscription_expired

Parameters:

  • af_content_id: String

  • reason: String

Subscription refunded

Default event name: apphud_subscription_refunded

Parameters:

  • af_content_id: String

  • af_revenue: Float

  • af_currency: String

  • reason: String

Promo Offer

Promotional offer started

Default event name: apphud_promo_started

Parameters:

  • af_content_id: String

  • offer_id: String

  • af_revenue: Float

  • af_currency: String

  • offer_type: String

  • unit: String

  • units_count: Integer

Promotional offer renewed

Default event name: apphud_promo_renewed

Parameters:

  • af_content_id: String

  • offer_id: String

  • af_revenue: Float

  • af_currency: String

  • offer_type: String

  • unit: String

  • units_count: Integer

Successful conversion from promotional offer to regular subscription

Default event name: apphud_promo_converted

Parameters:

  • af_content_id: String

  • offer_id: String

  • af_revenue: Float

  • af_currency: String

  • offer_type: String

Failed conversion from promotional offer to regular subscription or failed renew

Default event name: apphud_promo_expired

Parameters:

  • af_content_id: String

  • offer_id: String

  • reason: String

  • offer_type: String

Refund during promotional offer

Default event name: apphud_promo_refunded

Parameters:

  • af_content_id: String

  • offer_id: String

  • af_revenue: Float

  • af_currency: String

  • reason: String

  • offer_type: String

Autorenew

Autorenew disabled

Default event name: apphud_autorenew_disabled

Parameters:

  • af_content_id: String

Autorenew enabled

Default event name: apphud_autorenew_enabled

Parameters:

  • af_content_id: String

Set up Subscription Status URL to receive autorenew_disabled and autorenew_enabled events in real-time. More information can be found here.

Testing AppsFlyer with Sandbox Purchases

If you want sandbox purchases not to mix with your production purchases in AppsFlyer, you should create a Test App ID.

  • Create a new app in AppsFlyer as described here.

  • Enter newly created Test App ID toTest App Store app ID field in AppsFlyer Integration page in Apphud.

  • Add the following line before Apphud SDK initialization:

Apphud.setIntegrationsTestMode()
  • Change App ID to a Test App ID when initializing AppsFlyer SDK:

AppsFlyerTracker.shared().appleAppID = "0123456789"

We recommend to wrap this code into #DEBUG macros to make sure it doesn't accidentally get to the App Store.

Testing Subscription Events

Step 1
2
3
4
✅ 5
Step 1

Please make sure AppsFlyer SDK is properly integrated in your app and AppsFlyer integration is configured in Apphud.

2

Open Xcode, remove your app from test device and Run the app.

3

Make a test purchase in your app.

You can read more about testing purchases here.

4

You will see attribution data in user's page:

✅ 5

Open "Events" tab in AppsFlyer and you will see Apphud events there: