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
An email account with admin access to Google Analytics 4 accounts is required to complete the setup.
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
To access a GCP Project, follow the steps below:
- Access the Google Cloud Platform console.
- 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:
- In the Google Cloud Platform interface, open the console left side menu and select APIs & services.
- On the left, click Library, search for the “Google Analytics Data API” and select it. Click Enable.
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.
If there is no existing app, you will see the first step of the creation process:
- Choose the Internal option if you are a Google Workspace user, otherwise choose External. Click the Create button
- Under App information, enter an App name. It can be something similar to the project name.
- User support email: enter your email address (the one used to connect to GCP).
- Developer contact information, and email address: enter your email address (the one used to connect to GCP).
All other fields are optional.
- Click Save and continue
- Click Add or remove scopes.
- Tick the.../auth/userinfo.email scope. Validate by clicking Update.
- Click Save and continue
- Add your email address (the one used to connect to GCP) as a test user. Click Save and continue.
- You have reached the summary screen, click Back to dashboard
- On the dashboard of the created Oauth consent screen, you should switch the Publishing status to In production by clicking the Publish app button.
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:
- Open the console left side menu and selectAPIs & services.
- On the left, clickCredentials > Create Credentials > OAuth client ID.
- Select Web Application as the Application type. Give the bridge a descriptive name such as e.g. “GA4 to AB Tasty Audience bridge”.
- Under Authorised redirect URIs add “https://integrations-oauth.abtasty.com/ga4/callback”.
All other fields are optional.
- Click Createto finalize the OAuth credentials creation.
- 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).
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
To enable the integration on AB Tasty, follow the steps below:
- Access Profile > Integrations > DMP & CRM Onboarding.
- In the Other CDP/CMP tools box, select Google Analytics 4.
- Click the link in the description, Click Here (in the red square in the screenshot above).
- 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.
- 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.
- 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
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.
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).
To push the AB Tasty Visitor ID we use a user property named ab_tasty_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.
- In the left panel, click Configure>Create custom dimensions.
- Enter the Dimension name you want to display in Google Analytics 4 e.g. “AB Tasty Visitor ID”.
- Select User as the Scope.
- Enter a description (optional).
- Enter abtasty_visitor_id as the User property.
- Click Save.
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).