OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

Other Analytics Vendors

OneSignal Features - Integrating OneSignal with any Analytics vendor

For Developers
For Marketers

Notification Behavior Tracking

OneSignal supports tracking subscription and notification data when users subscribe and notifications are clicked on each platform, including sending this data to your analytics vendor so that it can be analyzed in the context of your other user data.

Mobile

Tracking Mobile Notification Received and Clicked Events

Received: Send an event to your analytics system from the SDKs NotificationReceived event handler when a notification is received. Keep in mind, this event only gets called if the app is open and in the foreground or background. It will not get called if the app has been swiped away.

Clicked: Send another event to your analytics system from the NotificationOpened or Action event handler when a notification is clicked.

Tracking Mobile Subscription Events

Send a subscription event to your analytics system from the SDKs PermissionObserver event handler when a user subscribes.

iOS

Android

Track Subscription Event


Web Push

By Page JavaScript

You can use the addListenerForNotificationOpened event of the OneSignal Javascript SDK to detect when a user clicks a notification.

This will track the notification ID and OneSignal player ID

<script>
OneSignal.push(["addListenerForNotificationOpened", function(data) {
    console.log("Received NotificationOpened:");
    console.log(data);
    console.log(data.id);
    console.log(data.heading);
    OneSignal.getUserId( function(userId) {
            console.log("OneSignal User ID:", userId);
            // Make a POST call with the notification data and userId aka playerId
     });
}]);
</script>

Tracking Subscriptions

You can use the notificationPermissionChange event of the OneSignal Javascript SDK to detect when a user subscribes to notifications or unsubscribes from notifications on your site.

This will track the subscription change event and the OneSignal player ID

<script>
OneSignal.push(function() {
    // Occurs when the user's subscription changes to a new value.
    OneSignal.on('subscriptionChange', function (isSubscribed) {
        console.log("The user's subscription status has change, isSubscribed:", isSubscribed);
        OneSignal.getUserId( function(userId) {
            console.log("OneSignal User ID:", userId);
            // Make a POST call with the subscription data and userId aka playerId
        });
    });
});
</script>

Tracking Notification Receipts & Dismissals

Advanced Topic

To track all the users that received, dismissed, and opened a notification, you can use Webhooks