React Native SDK - Supporting Push Notifications

Supporting Re-engagement Tracking using Push Notifications

Singular supports push notification tracking to enhance re-engagement measurement. By integrating Firebase Cloud Messaging (FCM) with the Singular SDK, you can track users who interact with push notifications and attribute them accordingly.

To ensure accurate tracking, follow the implementation guidelines below and make sure that notification data is correctly passed to the Singular SDK.

Why is Push Notification Tracking Important?

Push notifications are a key re-engagement tool, but tracking them requires correct integration. Singular ensures that users who interact with notifications are properly attributed, helping optimize marketing campaigns and engagement strategies.


Implementation Guide

Integrate the Singular SDK

Integrate the Singular SDK in your React Native project using the official instructions provided in the Singular documentation.


Set Up Push Notifications

  • Set up push notifications using Firebase Cloud Messaging
  • Make sure the following React Native plugin's are added:

    bash
    npm install @react-native-firebase/app
    npm install @react-native-firebase/messaging

iOS

  • Register your iOS app in Firebase.
  • Add GoogleService-Info.plist to your Xcode project.
  • Enable Push Notifications and Background Modes (Remote notifications).

Android

  • Register your Android app in Firebase.
  • Add google-services.json to your project in android/app/.
  • Ensure that Firebase messaging dependencies are added and permissions are granted.

Handling Push Notifications with Singular SDK

iOS

App in Background or Foreground

Call below method where notification the is handled:

javascript
Singular.handlePushNotification(notificationPayloadData);

App in Terminated State

In AppDelegate.m, add the following line inside didFinishLaunchingWithOptions:

AppDelegate.m
[SingularBridge startSessionWithLaunchOptions:launchOptions];

Android

App in Background or Foreground

In your main activity (e.g., MainActivity.java), override onNewIntent:

MainActivity.java
@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    SingularBridgeModule.onNewIntent(intent);
}

App in Terminated State

No action is required. The React Native bridge layer handles this scenario automatically.


Configure Push Link Paths

Configure the Singular SDK to recognize specific paths in your notification payloads for Re-engagement attribution. Update the SingularConfig object with the withPushNotificationsLinkPaths options.

App.tsx
config.withPushNotificationsLinkPaths([
  ["path", "to", "url"]]);

Validation Guide

Step 4: Validating/Verifying Push Notification Receipt in the Start Session Call

The Singular SDK API call ensures that the push notification payload link is correctly passed under the singular_link reserved parameter in the start session call.

Example:

bash
https://sdk-api-v1.singular.net/api/v1/start?a=<SDK-Key>&ab=arm64-v8a&aifa=180f63a1-0955-47b4-896a-d75ae3d35955&apc=Marchv7&apg=1&aps=Intex&asid_scope=1&asid_timeinterval=0.112&av=20.0&br=samsung&c=wifi&current_device_time=1740905574088&de=m15x&device_type=phone&device_user_agent=Dalvik/2.1.0 (Linux; U; Android 14; SM-E156B Build/UP1A.231005.007)&dnt=0&event_index=3&fi=e5bRZuVddO8:APA91bHXI3OmFZv3-r8f03zyji2kvKWbIngwf8KBDHk4Rj5q5MEeEm6EtzC-if1vpJRmuYLyGdAcSz9-nc49eIjD86xwj-n9J4jKucqMVt9mP8ICifP0arA&i=net.singular.singularsampleapp&install_time=1740905507036&is=false&k=SDID&lag=0.067&lc=en_IN&ma=samsung&mo=SM-E156B&n=Singular-TestApp-Debug&p=Android&pr=m15xnndins&pu=1&rt=json&s=1740905574084&sdk=Singular/v12.6.2&singular_install_id=2dc5dfc2-a2a8-484a-aad1-fed6cb7a3023&singular_link=https://singularassist2.sng.link/C4nw9/r1m0?_dl=singular://test&_smtype=3&src=com.android.shell&u=75f7b911-5a77-597d-8892-56f5e0e210ff&update_time=1740905507036&v=14&h=1e723fd90344d5d037059f110611ed1d84fbba88


Alternatively, you can use the Singular SDK Console to verify the push notification tracking link under the Deeplink URL, as demonstrated below.

By verifying this, you can confirm that push notification engagements are correctly tracked within the Singular SDK.

Notes:

  • Please note that, unlike the singularLinksHandler code, the Singular SDK does not provide push payload callbacks for this feature. It is the responsibility of the app developer to read the push notification data and implement the deep linking logic to redirect users to specific product pages within the app. In this solution, Singular retrieves the push notification payload when the user taps on the notification and includes this payload in the SDK start session event triggered by Singular.start(config). This data is then processed on the Singular backend to attribute the push notification touchpoint/click and register it for re-engagement tracking.
  • We have a safety mechanism in place that allows only Singular link domains from the custom key value pair passed in the push notification payload. Specifically, only sng.link domains predefined in the Singular Manage Links page are permitted.

    For example:
    https://prod_test.sng.link/B0s2a/51oi?_dl=singular%3A%2F%2Fmain

    If you intend to wrap Singular links within a different domain (e.g., an ESP domain for email service providers), you must explicitly configure the domain by adding the following option in your setup: This ensures that the external domain is recognized and allowed within the Singular framework. please refer to the below configuration example. config.withESPDomains(Arrays.asList("sl.esp.link"));

  • If you need to trigger different deep links based on user actions from a single push notification, you can use a single Singular tracking link and dynamically modify redirects.

    Example:

    A push notification for breaking news may offer multiple deep link options! Instead of creating multiple tracking links, configure one Singular tracking link and adjust redirects dynamically based on user selection.

    Read Latest News
    newsapp://article?id=12345
    Trending Topics
    newsapp://trending
    Sports
    newsapp://sports


    Learn more about overriding redirects in Singular tracking links.

Success!

By following these steps, your app is now set up to track push notification interactions using Singular. This helps improve campaign performance insights and ensures accurate re-engagement attribution.