> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.onesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

## Mobile GA guide

See our [Google Analytics for Firebase](./google-analytics-for-firebase) guide for more details.

## Web push GA guide

Start with [Adding Google Analytics](https://developers.google.com/analytics).

***

## Tracking web push notification clicks

<Accordion title="By UTM parameters">
  You can [automatically add UTM parameters to push notification URLs](./links#utm-parameters) 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.

  When sending a notification, pick a `utm_source` (eg. "onesignal"), a `utm_medium` (eg. "web-push" or "api" vs "automated" vs "dashboard"), and a `utm_campaign` parameter (eg. "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.
</Accordion>

<Accordion title="By page JavaScript">
  You can [listen for the click event](./web-sdk-reference#click) which fires when a user clicks a notification that directs them to a page of your site with this code.
</Accordion>

## Tracking subscriptions

<Accordion title="Tracking impressions of the opt in request pop-up">
  You can [listen for the `permissionPromptDisplay` event](./web-sdk-reference#addeventlistener-slidedown) to track if the prompt actually displays to the user. If no permission prompt is displayed, the user cannot opt-in to push.
</Accordion>

<Accordion title="Permission prompt change events">
  You can [listen for the `permissionChange` event](./web-sdk-reference#permissionchange) 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.
</Accordion>

<Accordion title="Tracking push subscription change">
  You can [listen for the `change` event](./web-sdk-reference#addeventlistener-push-subscription) 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 prompts.
</Accordion>

<Accordion title="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](./webhooks).

  For example, you can construct a webhook on top of the [Google Analytics Measurement Protocol feature](https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag), 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.
</Accordion>

***
