Google Analytics integration
Google Analytics User ID feature lets you collect and apply comprehensive user data by connecting multiple data resources to the same users.
Connect Pushwoosh with Google Analytics and use GA data for audience segmentation and targeting your push notifications campaigns. Letās see how it works.
Enable User ID
Section titled āEnable User IDāTo enable User ID feature in your Google Analytics account, follow the Google guide: https://support.google.com/analytics/answer/3123666
Set up User ID in your tracking code
Section titled āSet up User ID in your tracking codeāIntegrate Pushwoosh Web SDK
Section titled āIntegrate Pushwoosh Web SDKāTo integrate Pushwoosh SDK in your Google Tag Manager, follow the Web Push SDK guide.
Create User ID tag in GTM
Section titled āCreate User ID tag in GTMāCreate a Custom HTML Tag firing on All Pages trigger.
Use the following code to set up User ID that matches the user data between Pushwoosh and Google Analytics.
In the example below, we use Pushwoosh Hardware ID (HWID) to set up User ID. You can use a different identifier, but be aware not to put email addresses or any other personally identifiable information (PII) into User ID as this is not compliant with Google Analytics Privacy Policy.
<script> var registrationStatus = localStorage.deviceRegistrationStatus; var registrationId = localStorage.deviceRegistrationId; var gaRegistered = registrationStatus === 'registered' ? registrationId : false;
if (!gaRegistered) { var Pushwoosh = Pushwoosh || []; Pushwoosh.push(['onPermissionGranted', function(api) { api.getParams() .then(function(params) { var hwid = params.hwid; ga('set', 'userId', hwid); ga('send', 'pageview'); localStorage.setItem('deviceRegistrationId', hwid); api.registerUser(hwid); }) }])};</script>

Add User ID to Page View tag
Section titled āAdd User ID to Page View tagāModify your Page View tag to include User ID if it is known for the user:
<script> var hwid = localStorage.deviceRegistrationId; var registrationStatus = localStorage.deviceRegistrationStatus; var isNeedToTrackUser = hwid && registrationStatus === "registered";
if (isNeedToTrackUser) { ga('set', 'userId', hwid); }; ga('send', 'pageview');</script>

Test with User ID coverage report
Section titled āTest with User ID coverage reportāTo test the integration, use āUser ID coverage reportā:
https://support.google.com/analytics/answer/3123670
User Explorer
Section titled āUser ExplorerāSelect your User ID reporting view in Google Analytics. Add any segments there to slice and dice your audience.

You can see your User IDs displayed in āUser IDā column.

Press the Export button and select the āCSVā option.
Send push notifications by GA User IDs
Section titled āSend push notifications by GA User IDsāNavigate to CSV Push tab in your Pushwoosh Control Panel and upload the CSV file exported in the previous step.

Select the first column and choose āUser IDā for the Data Type.
Select a preset in the corresponding dropdown field, set the date (if necessary), and click Woosh!

Youāve just sent a push notification to your users from Google Analytics!