Adobe Analytics
OneSignal Features - Integrating OneSignal with Adobe Analytics
OneSignal supports tracking subscription and notification data when users subscribe and notifications are clicked on each platform, including sending this data to Adobe Analytics so that it can be analyzed in the context of your other user data.
Mobile Guide
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.
Event | SDK Method | Details |
---|---|---|
Track Notification Received | Handle Notification Received Method | Android - Method fired when the notifications is received. iOS - Method fired when notification is received while app is in focus. |
Track Notification Clicked | Handle Notification Click/Opened Method | Method fired when the notification is clicked and opens the app. |
Tracking Mobile Subscription Events
Send a subscription event to your analytics system from the SDKs PermissionObserver
event handler when a user subscribes.
Event | SDK Method | Details |
---|---|---|
Track Subscription Event | Permission Change Event | Method fired when user changes permission status. Use to track: - Notification permission prompt shown (iOS) - The user accepting or declining the permission prompt (iOS) - Enabling/disabling notifications for your app in the App Settings and after returning to your app. |
Web Push
Start with the Adobe Analytics Setup Guide.
Tracking Web Push Notification Clicks
By Page JavaScript
You can use the addListenerForNotificationOpened event of the OneSignal Javascript SDK to detect when a user clicks a notification.
Add the Adobe Analytics Tracking code to the head tags of your site, then add this code to the body tags of the page you are directing users upon clicking the notification. This will track the notification ID and OneSignal player ID
<script>
OneSignal.push(["addListenerForNotificationOpened", function(payload) {
console.log("OneSignal Notification Clicked Paylaod:");
console.log(payload);
OneSignal.getUserId( function(userId) {
console.log("OneSignal User ID:", userId);
//Make a POST call to Adobe Analytics with the notification data and userId aka playerId
});
}]);
</script>
Tracking Subscriptions
Permission Prompt Change Events
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.
Add the Adobe Analytics Tracking code to your site, then add this code to the body tags of the pages users can subscribe. This will track the subscription change event and the OneSignal Player ID.
OneSignal.push(function() {
// Occurs when the user's subscription changes to a new value.
OneSignal.on('notificationPermissionChange', function(permissionChange) {
var currentPermission = permissionChange.to;
console.log('New permission state:', currentPermission);
OneSignal.getUserId( function(userId) {
// Make a POST call to Adobe Analytics with the subscription data and userId aka playerId
});
});
});
This will create several event actions in Adobe Analytics when users opt-in or opt-out.
You can then use filtering options in Adobe Analytics to track by day, week, month, landing pages and browsers.
Tracking Impressions of the opt in request pop-up
You can use the permissionPromptDisplay method to send an event to Google Analytics from your page's code, like so:
OneSignal.push(function() {
// Occurs when native browser prompt is shown
OneSignal.on('permissionPromptDisplay', function() {
console.log("The native prompt displayed");
// Make a POST call to Adobe Analytics with the Prompt data
});
});
This will create an event in Adobe Analytics that you can track and filter by day, week, month, landing pages and browsers.
Tracking Actual Subscription Change
You can use the subscriptionChange event to track when specific users subscribe or unsubscribe from web push.
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 state is now:", isSubscribed);
OneSignal.getUserId( function(userId) {
// Make a POST call to Adobe Analytics with the subscription data and userId aka playerId
})
});
});
Tracking Notification Receipts & Dismissals
Advanced Topic
We recommend sending this data to Adobe Analytics as well (or another analytics tool). However since your website may not be open when notifications are received, dismissed, and opened by a user, this should be done by using our Webhook support.
Filtering options like by day, week, month, browser, template will be available in Adobe Analytics alongside the above event for your use.
Updated over 2 years ago