Google Analytics

Step-by-step guide to integrate Google Analytics for segmentation


Google Analytics Universal no longer supported after July 1, 2023

Universal Analytics will be replaced by Google Analytics 4. This replacement will sunset the Google Analytics 3 integration on the platform.

As a result of this, Google Analytics segments will not be available to use in the campaigns. The new Google Analytics 4 integration will only support gathering Google Analytics IDs from web SDKs. Review instructions on how to upgrade to Google Analytics 4 on your connected websites, to continue collecting GA IDs after July 1, 2023.

Google Analytics can be integrated with your Xtremepush project to allow users to utilise segments created in Google Analytics in the Xtremepush segmentation engine.

To enable the integration via the platform first go to your Google Cloud Platform developer console and pick the project you will use to work with your website and Google Analytics:

Google Cloud Platform developer console

On your dashboard click on APIs and services (from the left hand menu):

Then from the APIs and services page click on enable APIs and services, which will open the API library.

From the API library navigate to Other and select Google Analytics API:

Then click Enable

On the left hand navigation menu click Credentials, on the credentials select on your service account and click on the title of your service account > Keys > Add key > Create new key.

Then select P12 > Create.

Your new key will be downloaded automatically (make sure you are using Chrome as your browser) you will use this later:

After returning to the credentials page, click on Service Accounts from the left hand menu and copy the associated email with your service account.

Now that you’ve created your new service account you will need to add this ‘user’ to your Google Analytics account.

Google Analytics

Login to Google Analytics and then go to the admin dashboard section.

Under the first column labeled Account select Account user Management.

Now go ahead and add the email address that is associated with your service account (and that we copied before) by clicking on the plus icon. The email that you enter should be in the format [email protected].

As we will only be using this account to extract data from your Analytics account you can set the user privileges to Read & Analyze. Finally click on Add.


Now go back to your Analytics admin dashboard and navigate to the View Settings link, located in the third column (View). Take a note of the View ID; this will be required later.

Now we must go back to the Xtremepush dashboard to complete the integration with Google Analytics.


Navigate to Settings > Integrations > Google Analytics. Slide the Enable toggle. Enter the service account email and the Google Analytics view ID generated as described above, upload your certificate. Select the next available Google Analytics custom dimension (Dimension go from 1-20 for regular GA accounts). Save your settings and your Google Analytics integration is almost complete.

Just make sure to add a corresponding custom dimension on Google Analytics by navigating to Admin > select the property for which you want to add the custom dimension. In the property column, click Custom Definitions > Custom Dimensions > New custom dimension. You can call this dimension anything, for example Xtremepush ID; just make sure the dimension number on the certs & keys page matches and that the scope is User:

Alternatively Xtremepush can auto generate the custom dimension if you are happy to give the service account user you are using for the integration edit permissions in the user access management section of Google Analytics.

Then you can leave the custom dimension field blank in Xtremepush and it will be auto generated when you save.