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
  10. You have reached the summary screen, click Back to dashboard
  11. On the dashboard of the created Oauth consent screen, you should switch the Publishing status to In production by clicking the Publish app button.

image002.png

 

The OAuth consent screen is now ready and you proceed to the OAuth Credentials creation step.

 

OAuth Credentials Creation

 

To create OAuth 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://integrations-oauth.abtasty.com/ga4/callback”.
    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

 

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

 

Enabling the Integration on AB Tasty

Capture d’écran 2023-10-24 à 19.11.01.png

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

  1. Access Integrations > Integration Hub > Pull.
  2. Search for and select Google Analytics 4.
  3. Click Setup connector.
  4. Give a name to your connector so you can easily retrieve it.
  5. Input your Measurement ID
  6. Click Authorize and Create.

Capture_d_e_cran_2023-05-22_a__14.51.42.png

  1. You are redirected to another setup screen. You have different fields to fill in to set up the integration :
  • Connector Name: the name of the connector, you can name it as you want. We recommend giving it an explicit e.g. "GA4 - propertyXX" (here propertyXX would be the id of the property you will pulling audiences from.
  • 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.

2. Once every fields are filled, click Get refresh token

Integration_Guide_CDP_CRM_Tools_21.pngIntegration_Guide_CDP_CRM_Tools_22.png

3. You are redirected to Google's authorization screen: select the account with which you have access to the Google Analytics property and then click Authorize to grant access. This will authorize AB Tasty pull data (audiences from your GA4 API).

4. You are redirected to AB Tasty's settings interface and you can see the GA4 connector activated. If you click on the connector, you will see all the fields filled including the refresh token.

 

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

 

Congratulations! The GA4 pull integration is now set up on AB Tasty's side. You now have to configure GA4 in order to make it work (see next step).

 

Configuration 

 

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

 

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_id to 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?

/