Google Analytics

OneSignal Features - Integrating OneSignal with Google Analytics

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

πŸ“˜

You're Viewing User Model Documentation πŸŽ‰

OneSignal is in the process of migrating from a device-centric model (player ID) to a new user-centric data model (OneSignal ID). To learn more, check out the User Model Migration Guide.

Please refer to Version 9 of our documentation for device-centric information.

Mobile GA Guide

See our Google Analytics for Firebase guide for more details.


Web Push GA Guide

Start with Adding Google Analytics.

Tracking Web Push Notification Clicks

By UTM Parameters

You can automatically add UTM parameters to push notification URLs through the OneSignal Dashboard.

The easiest way to track notification clicks is to add Google Analytics UTM parameters to the end of the URL for the notification. Here's an overview on UTM parameters: http://blog.rafflecopter.com/2014/04/utm-parameters-best-practices/

When sending a notification, please pick a utm_source (Such as "onesignal"), a utm_medium (Such as "web-push" or "api" vs "automated" vs "dashboard"), and a utm_campaign parameter (Such as "promotional-offer-template-123"). Next, add these parameters to your url, like so:

https://yoursite.com/your-page?utm_source=onesignal&utm_medium=web-push&utm_campaign=promotional-offer-template-123

After this, in Google analytics you can visit the Acquisition -> All Campaigns view to see all the campaigns you have sent and filter by day, browser, or campaign.

If you are having issues with UTM parameters, please see this article on common UTM parameter mistakes: https://penguininitiatives.com/common-utm-campaign-url-tracking-mistakes-to-avoid/

By Page JavaScript

You can listen for the click event which fires when a user clicks a notification that directs them to a page of your site with this code.

Tracking Subscriptions

Tracking Impressions of the opt in request pop-up

You can listen for the permissionPromptDisplay event to track if the prompt actually displays to the user. If no permission prompt is displayed, the user cannot opt-in to push.

Permission Prompt Change Events

You can listen for the permissionChange event to detect when a user changes their permission status on the browser. This is best for tracking actual opt-ins on the site after the permission prompt is displayed.

Tracking Push Subscription Change

You can listen for the change event to track when specific users subscribe or unsubscribe from web push. This will fire after the user opts-in and/or if the user opts-out using the Bell Prompt, Custom Link Prompt, optIn/optOut methods, or in the browser settings and returns to the site.

Tracking Notification Receipts & Dismissals

We recommend sending this data to Google 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.

For example, you can construct a webhook on top of the Google Analytics Measurement Protocol feature (https://developers.google.com/analytics/devguides/collection/protocol/v1/), then provide that URL with the query parameters of your choice when initializing OneSignal.

Filtering options like by day, week, month, browser, template will be available in Google analytics alongside the above event for your use.