OneSignal integration with AppsFlyer

At a glance: OneSignal, an AppsFlyer integrated partner, is the market-leading push notification & in-app messaging provider. Supporting over 1 million developers and marketers with a best of breed engagement platform, 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

onesignal-logo_en-us.png

Some media sources restrict sharing data with third parties. AppsFlyer doesn't share user-level data of users acquired through these media sources with third-party platforms or services. Installs from these media sources are sent as organic. Currently, OneSignal doesn't internally use organic users data.

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 you 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 you 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);
      

Activate integration

To activate the integration with OneSignal:

  1. In Appsflyer, go to Configuration > Integrated Partners.
  2. Select OneSignal. 
  3. In the Integration tab, enable Activate partner

Learn more about the partner configuration window header.

Integration tab

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

Activate partner

This toggle must be enabled for as long as you work with the partner.
Learn more about partner activation.

General settings

App ID

To connect your OneSignal account with AppsFlyer, enter your app ID in 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

Was this article helpful?