OneSignal integration with AppsFlyer

At a glance: OneSignal is the market-leading push notification and in-app messaging provider, supporting over 1 million developers and marketers with a best-of-breed engagement platform.

onesignal-logo-stack__3_.png

OneSignal delivers 8 billion messages every day across the globe. Powered by superior architecture and an easy-to-use platform, the OneSignal delivers messages faster, more efficiently, and at a greater scale than any other solution in the world. Learn more at onesignal.com

 Important!

Some media sources restrict sharing data with third parties. Therefore, postbacks for restricted events won't be sent to this partner, regardless of the configured selection for sending postbacks.

Setting up OneSignal

The integration with OneSignal includes inserting a few lines of code to the AppsFlyer SDK in your app and then activating the integration in AppsFlyer.

Set up the AppsFlyer SDK

When using Android, integrating with OneSignal requires that the OneSignal Player ID (OneSignal unique user identifier) is populated in AppsFlyer Android SDK. This parameter is sent with every postback and enables the identification of each user.

To set up the AppsFlyer Android SDK:

  1. Make sure that the SDK version you use is 2.3.1.18 and above.
  2. Insert the following lines of code in your app's code - after OneSignal SDK was launched and before the initialization code for AppsFlyer SDK.
    • For Android devices using OneSignal SDK version 3.x.x:
      OSPermissionSubscriptionState status = OneSignal.getPermissionSubscriptionState();
      String deviceId = status.getSubscriptionStatus().getUserId();
      customData.put("onesignalCustomerId", deviceId);
    • For Unity SDK:
      var status = OneSignal.GetPermissionSubscriptionState();
      String deviceId = status.subscriptionStatus.userId;
      customData.put("onesignalCustomerId", deviceId);
    • For Android devices using OneSignal Native SDK version 4+:
      OSDeviceState device = OneSignal.getDeviceState();
      String deviceId = device.getUserId();
      customData.put("onesignalCustomerId", deviceId);

To set up the AppsFlyer iOS SDK:

  1. Make sure that the SDK version you use is 2.3.1.18 and above.
  2. Insert the following lines of code in your app's code - after OneSignal SDK was launched and before the initialization code for AppsFlyer SDK.
    • For iOS devices using OneSignal SDK version 2.x.x:
      Swift Objective-C
      let status: OSPermissionSubscriptionState = OneSignal.getPermissionSubscriptionState()
      if let deviceId = status.subscriptionStatus.userId{
          customData.put("onesignalCustomerId", deviceId);
      
    • For iOS devices using OneSignal Native SDK version 3+:
      Swift Objective-C
      if let deviceState = OneSignal.getDeviceState() {
          let deviceId = deviceState.userId
          customData.put("onesignalCustomerId", deviceId);
      

To activate or edit the integration

Prerequisite: Before setting up the integration, make sure you contact the partner and open an account with them.

  1. To activate: In AppsFlyer, from the side menu, select Collaborate Partner Marketplace.
    To edit: In AppsFlyer, from the side menu, select Collaborate Active Integrations.
  2. Search for the partner and select it.
  3. Click Set up integration. You’re directed to the integration setup page.
  4. In the Integration tab, select the app for the integration and turn Activate partner on.
    Note: The toggle must be on (activated) for as long as you work with the partner.
  5. Complete the configuration using the relevant tabs, as described below.

Learn more about the partner configuration window header.

Integration tab

onesignal-integration-tab.png
The Integration Tab is divided into different sections as described below.

Activate partner

Must be enabled for as long as you work with the partner.
Learn more about partner activation.

General settings

OneSignal AppID

To connect your OneSignal account with AppsFlyer, enter your app ID in OneSignal AppID field.
Your OneSignal app ID is available in the OneSignal platform under Settings > Keys & IDs.

onesignal-app-id-en_us.png

Default postbacks

onesignal-default-postbacks_en-us.png

AppsFlyer can send automatic postbacks to OneSignal following user installs. Use this section to define the source of the users that the postbacks are sent to for each event.
Learn more about default postbacks.

To send postbacks for any user that downloads the app to OneSignal, select All media sources, including organic.

To complete the integration configuration, click Save Integration.

Although all events are sent by AppsFlyer, organic installs are not counted by OneSignal and therefore are ignored by OneSignal API.

Once you have saved the configuration, AppsFlyer sends the following data to OneSignal for every organic and non-organic install:

  • Media source
  • Campaign name
  • Device ID
  • Ad ID

Attribution link tab

Attribution Links are not available for this partner.

Cost tab

Cost data is not applicable in the integration with this partner.

Ad revenue tab

Ad Revenue is not applicable in the integration with this partner.

Permissions tab

Permissions are not available for this partner.

View user attribution data in OneSignal

You can view attribution in the Segment Editor under the OneSignal tags either as the individual device level or when creating a segment to use in a campaign.

onesignal-view-attribution_en-us.png