At a glance: Measure push notification campaigns on both iOS and Android.
Overview
AppsFlyer supports the measurement of push notification campaigns from all push providers, as well as campaigns implemented directly on top of Firebase Cloud Messaging or Apple Push Notification Services (APNS).
There are 2 possible ways to implement the integration:
- By utilizing OneLink links (recommended).
- By sending a JSON object with an
af
key in the push notification's payload (legacy).
The conversions display in the Overview dashboard, in the retargeting or unified views.
How does it work?
Once you've completed the steps in this article, your app will work as follows:
- You trigger a push notification that contains a OneLink link or an
af
key in its payload. - The app user receives the push notification and clicks on it.
- The app loads and the AppsFlyer SDK starts.
- The SDK processes the payload of the push notification that opened the app.
- The SDK extracts and sends the attribution data to AppsFlyer.
In the OneLink scenario, if the OneLink is configured to route the user to a specific location in the app, the deep link flow is triggered.
Prerequisites
Before continuing, make sure that your app has the AppsFlyer SDK integrated and can receive push notifications.
Steps
To set up push notification measurement, the following steps must be completed:
-
Create a push notification that contains a custom data key with the OneLink link or an
af
key with a JSON object as its value. - Configure the SDK to resolve the custom key (done by the app developer).
- Test the integration by triggering a push notification.
- View push notification campaigns performance in the dashboard.
1. Creating the push notification
First, create a push notification that contains attribution data using one of the following methods.
Note
In the following demonstration, we're using Firebase as the push provider. The instructions should be applicable to any push provider, with minor differences (if any). Consult the respective push provider's documentation.
Using OneLink (recommended)
This is the recommended method of integrating AppsFlyer with push notifications.
- Create a OneLink link and set it up for retargeting.
Note: OneLink short and long URLs are both supported. - In the push notification custom data, add the OneLink that contains the attribution data you want to send to AppsFlyer.
Using JSON (legacy)
Note
The following documents the legacy method of integrating AppsFlyer with push notifications, and is available for backward-compatibility purposes. If you’re setting up a new app, use the recommended OneLink-based solution.
In the push notification's custom data, add a custom key called af
that contains the attribution data you want to send to AppsFlyer in JSON format. The following attribution parameters are required:
pid
is_retargeting
c
2. Configuring the SDK
This task requires changes to the app code. Follow the instructions on how to configure the SDK:
- When implementing the recommended OneLink-based solution:
- let the app developer know what's the name of the custom key you added to the notification. In this example, it's
af_push_link
. - Send them these instructions.
- let the app developer know what's the name of the custom key you added to the notification. In this example, it's
- When implementing the legacy JSON-based solution, send your developers these instructions.
3. Testing the integration
To test that push notification measurement is integrated correctly, simply trigger a push notification in the campaign you set up in Step 1.
If everything is configured properly, the SDK will:
- Listen to push notifications.
- Process the attribution data embedded in the push notification and send it to AppsFlyer.
- Proceed with the regular deep linking flow, if push notification measurement is implemented using OneLink.
4. Viewing push notification campaigns in the dashboard
You can see data originating from push notifications in the Retargeting dashboard.
Note: AppsFlyer deduplicates push notification data. Meaning, if identical payloads are received more than once, only one is counted.