Google Analytics 4

G4 & AB tasty

 

Google Analytics is an analytics service that enables you to measure traffic and engagement across your websites and apps. Google Analytics 4 is the latest version of Google Analytics. 

The Google Analytics 4 integration allows you to receive the audience created in Google Analytics, and to target them with AB Tasty.

 

Good to Know 💡- Google Analytics 4 Audiences
Audiences are groups of users defined by a chosen set of criteria. Dimensions, metrics, and events can be used to segment practically any subset of users.
For further information on how to use audiences, please refer to the audience manager guide

To achieve Google Analytics 4 audience targeting, we push our unique identifier (AB Tasty visitor ID) into a user property for every session and then list the value of this user property for the different existing audiences through Google Analytics API. The following day, audiences and their makeup are sent to AB Tasty.  

 

Thus, the Google Analytics 4 integration setup process is taking place on several platforms :

  • Google Cloud Platform: to create the credentials to access the Google Analytics data
  • Google Analytics 4:to set up the collection of the AB Tasty visitor ID
  • AB Tasty: to effectively set up the integration 

 

Heads up
An email account with admin access to Google Analytics 4 accounts is required to complete the setup. 

 

Integration

 

Creating the Credentials on the Google Cloud Platform


We need credentials with granted access to access Google Analytics 4 API programmatically. Those are OAuth types of credentials and are created within the Google Cloud Platform.

 

Accessing a GCP Project

Integration_Guide_CDP_CRM_Tools_10.png

To access a GCP Project, follow the steps below:

  1. Access the Google Cloud Platform console.
  2. Select an existing project or create a brand new one. (Documentation to create a bespoke project)

 

Activating the Google Analytics 4 API

 

To activate the Google Analytics 4 API, follow the steps below:

  1. In the Google Cloud Platform interface, open the console left side menu and select APIs & services.
  2. On the left, click Library, search for the “Google Analytics Data API” and select it. Click Enable.

Integration_Guide_CDP_CRM_Tools_11.png

OAuth Credentials

 

OAuth Consent Screen Setup

 

Before creating the OAuth credentials, you need to check that you have an OAuth consent screen setup. If you don’t, you need to set it up (if you just created the GCP project, that will be the case). The OAuth consent screen is the screen that will appear when you grant access to your credentials. 

 

Check the OAuth consent screen: Open the console left side menu and select APIs & services: click Credentials > Create Credentials > OAuth consent screen. If you see an app already exists here, it means the consent screen is set up and you can proceed to the next step: OAuth Credentials creation.

Integration_Guide_CDP_CRM_Tools_12.png

If there is no existing app, you will see the first step of the creation process:

 

  1. Choose the Internal option if you are a Google Workspace user, otherwise choose External. Click the Create button

    Integration_Guide_CDP_CRM_Tools_13.png

  2. Under App information, enter an App name. It can be something similar to the project name.
  3. User support email: enter your email address (the one used to connect to GCP).
  4. Developer contact information, and email address: enter your email address (the one used to connect to GCP).
    All other fields are optional. 
  5. Click Save and continue

    Integration_Guide_CDP_CRM_Tools_14.png

  6. Click Add or remove scopes.
  7. Tick the.../auth/userinfo.email scope. Validate by clicking Update.
  8. Click Save and continue

    Integration_Guide_CDP_CRM_Tools_15.png

  9. Add your email address (the one used to connect to GCP) as a test user. Click Save and continue.

Integration_Guide_CDP_CRM_Tools_16.png

You have reached the summary screen, the OAuth consent screen is now ready and you proceed to the OAuth Credentials creation step.

 

OAuth Credentials Creation

 

To create QAuth credentials, follow the steps below:

 

  1. Open the console left side menu and selectAPIs & services.
  2. On the left, clickCredentials > Create Credentials > OAuth client ID.

    Integration_Guide_CDP_CRM_Tools_17__1_.png

  3. Select Web Application as the Application type. Give the bridge a descriptive name such as e.g. “GA4 to AB Tasty Audience bridge”.
  4. Under Authorised redirect URIs add “https://developers.google.com/oauthplayground”.
    All other fields are optional. 
  5. Click Createto finalize the OAuth credentials creation.
  6. A confirmation message appears, it also displays the Client ID and the Client Secret of your Oauth credentials. Copy-paste and save for later (you can also download them in a .json format).

    Integration_Guide_CDP_CRM_Tools_19__1_.png

 

 

Giving Google Analytics OAuth Access

  1. Access Google OAuth Playground.

  2. Open the configuration panel and tick the Use your own OAuth credentials option. The Auth Client ID and OAuth Client secret fields appear. 

  3. Fill in the OAuth Client ID and OAuth Client secret fields with your own (saved from the previous OAuth Credentials step).

  4. In the left panel,Step 1 Select and authorize API, search for “Analytics Reporting API v4” and tick both items underneath (https://www.googleapis.com/auth/analyticsandhttps://www.googleapis.com/auth/analytics.readonly).

  5. Click Authorize APIs.

    Integration_Guide_CDP_CRM_Tools_20.png

  6. The Google Access Right interface appears: select the account with which you have access to the Google Analytics property and then click Authorize to grant access.

    Integration_Guide_CDP_CRM_Tools_21.pngIntegration_Guide_CDP_CRM_Tools_22.png

  7. You are redirected to Step 2Oauth Playground, Click Exchange authorization code for tokens.

    Integration_Guide_CDP_CRM_Tools_23.png

  8. Refresh token field is now populated, copy and save the content of the field.

Integration_Guide_CDP_CRM_Tools_24.png

Congratulations! You now have all the information you need to set up the integration on AB Tasty (see next step).

 

For further information on Oauth Playground please refer to this documentation.

For further information on Oauth 2.O please refer to this documentation or this documentation.

 

Enabling the Integration on AB Tasty

Integration_Guide_CDP_CRM_Tools_25.png

To enable the integration on AB Tasty, follow the steps below: 

 

  1. Access Profile > Integrations > DMP & CRM Onboarding.
  2. In the Other CDP/CMP tools box, select Google Analytics 4 Audiences. and click Connect.
  3. You have different fields to fill in to set up the integration :
    • Property ID: it is the unique ID of your GA4 property. To retrieve your Property ID, access the Google Analytics interface and click Admin > Property > Property Settings. Property ID appears at the upper right. For further information, please refer to this article.

Integration_Guide_CDP_CRM_Tools_26__1_.png

  • GA Measurement ID: it is the unique ID of a data stream (i.e. One of the data sources that provides data for your property). To retrieve your GA Measurement ID, access the Google Analytics interface and click Admin > Property > Data Streams > Web, and choose your data stream. GA Measurement ID appears at the upper right.
    For further information, please refer to this article.

Integration_Guide_CDP_CRM_Tools_27__1_.png

  • Client ID: part of the credentials to be able to access Google Analytics Data (see previous steps). 
  • Client secret: part of the credentials to be able to access Google Analytics Data. Copy and paste the value saved from the previous steps.
  • Refresh Token: part of the credentials to be able to access Google Analytics Data. Copy and paste the value saved from the previous steps.

 

Configuration 

 

To push the AB Tasty Visitor ID we use a user property namedab_tasty_visitor_id that is sent with an event named abtasty. Therefore, we need to set up the collection of custom definitions. 

 

The AB Tasty Visitor ID is then pushed back to AB Tasty for targeting.

 

  1. In the left panel, click Configure>Create custom dimensions.

    Integration_Guide_CDP_CRM_Tools_28__1_.png

  2. Enter the Dimension name you want to display in Google Analytics 4 e.g. “AB Tasty Visitor ID”.
  3. Select User as the Scope.
  4. Enter a description (optional). 
  5. Enter abtasty_visitor_id as the User property.
  6. Click Save.

Integration_Guide_CDP_CRM_Tools_29__1_.png

Congratulations, integration is now set up and you can view your Google Analytics 4 Audiences with AB Tasty. For information on how to use your audiences, please refer to this documentation.

 

Good to Know 💡- Technical Specification

  • Audiences will be refreshed daily
  • AB tasty pushes the abtasty_visitor_idto Google Analytics 4 with the abtasty event, thus once the integration is set up the abtasty event and abtasty_visitor_id will be visible on the Google Analytics 4 interface. 
  • The abtasty_visitor_id is used to match users.
  • For the audiences to be used in AB Tasty’s segment builder (once exported from Google Analytics 4), we need to match at least one user i.e. Empty audiences will not be displayed in the segment builder.
  • For the audience to be visible in the segment builder you need to wait 24 hours after the setup of the integration. This is due to the different synching mechanisms between the tools (data collection by Google Analytics 4 and then the data import from Google Analytics 4 to AB Tasty). 

Was this article helpful?

/