Online Data Provider: Google Analytics version 4

[Cloud release date: 2023.08.01]
[On-prem release: 2023 August]
[On-prem build: 23.08.31502]

What has happened?

The latest version of Google Analytics is called Google Analytics version 4 (or simply GA4).

Prior to that, Google Analytics was also known as Universal Analytics. By July 1, 2023 Google has decided that Universal Analytics will stop processing data, and by that time, you should have switched to GA4 to continue using the services of Google Analytics.

Read more about Google's decision here: Universal Analytics is going away

What should you do?

For TARGIT users, processing data from Google Analytics via TARGIT's data providers in Data Discovery or in InMemory ETL, you should also, as soon as possible, make the switch to GA4.

From this version, TARGIT 2022 Winter, TARGIT can use GA4 as a data source. The new provider is one of our Online Data Providers, meaning that if Google should decide to change anything in their API that breaks the connection, TARGIT will quickly detect it and correct it. You won't need to install any new drivers to get it up and running again.

The old Google Analytics provider will be able to co-exist with the new provider, and keep providing data until July 1, 2023.

You will need to enable GA4 for your Google account. Google documentation: Make the switch to Google Analytics 4

License

Your TARGIT license needs to support the Google Analytics Online Data Provider. Contact your TARGIT Account Manager if it doesn't.

How to register Google OAuth App

Note: Registration of the Google OAuth App is optional. You can use the TARGIT Google Analytics data provider out-of-the-box. 

Create a new project

  1. Go to https://console.cloud.google.com/projectcreate
  2. Give your project a name and select a location
  3. Click Create

image2023-2-8_9-50-56.png

Configure project

  1. Under APIs & Services, select OAuth consent screen
  2. You may need to first configure your Google Auth Platform by filling in information about App name, User support email, Audience (select External), Contact Information, etc.
  3. Once configuration is completed, click Create OAuth client
  4. Select Web application in the dropdown, and give it a name.
  5. Under Authorized JavaScript origins, add https://gaconnector.targit.com as a URI
  6. Click Create and copy the Client ID and Client secret from the following screen and store it for later use (e.g., in Notepad)
  7. Go to the Branding tab and make sure that you have filled in information about:
    1. App name
    2. User support email
    3. Application home page
    4. Application privacy policy link
    5. Application terms of service link
    6. Authorized domain
    7. Developer contact information
  8. Click the Verify button to verify this information. Note: Even if the verification process does not succeed or take a long time to complete, users will still be able to gain access as an "unsafe" application.
  9. Go to the Audience tab and Publish you app

Enable APIs

  1. Go to Enabled APIs & services
  2. Click + Enable APIs & services
  3. Locate, open and enable Google Analytics Admin API and Google Analytics Data API

Get Refresh Token

  1. Go to https://gaconnector.targit.com/ga4 and enter Client ID and Client secret
  2. Click Authenticate Google App. Google may ask you additional questions related to targit.com getting access to your app data. Please make sure that all necessary permissions are granted.
  3. If your app hasn't been verified at this point, you can still gain access by proceeding with the Advanced option
  4. Allow access to data
  5. At this point you should be returned to https://gaconnector.targit.com/ga4 with a Refresh Token. Copy the Refresh Token.

Set Up Connection

In ETL Studio or Data Discovery, set up your connection to Google Analytics 4.

ETL Studio

  1. Click Add Data Source
  2. Select Google Analytics 4
  3. Fill out Client ID, Client secret, and Refresh token
  4. Select Property
  5. Select dimensions and measures to include — use the validate button to make sure they have a relation
  6. Use Import to add data source to your project

Data Discovery

  1. Add a new data source
  2. Select Google Analytics 4
  3. Fill out Client ID, Client secret, and Refresh token
  4. Select dimensions and measures to include — use the validate button to make sure they have a relation
  5. Build a cube using the new data source

Troubleshooting

Insufficient Authentication Scopes

During setup of the Google Analytics 4 data source, you may see an error like this:

Reopen your Google Cloud / Google Auth Platform and go to the Data Access tab. Click the Add or remove scopes  button. You can then manually add this scope:

  • https://www.googleapis.com/auth/analytics.readonly

 

Google Analytics Snippet

https://developers.google.com/analytics/devguides/reporting/data/v1/basics

Google Analytics online data provider allows you to retrieve Google Analytics user data by using the new Google Analytics V4 API.

Firstly, you need to get the user Refresh Token using the https://gaconnector.targit.com/ga4

Please make sure that the Client ID and Client Secret are the same on the website and in the snippet. These parameters are hidden by the optional parameters.

When you type Refresh Token, snippet will fetch all available Google Analytics properties for user. For the selected property snippet will show all available dimensions and metrics. 

After selecting the necessary dimensions and metrics, you can validate your query by clicking Validate button. This is to check if the selected dimensions and metrics are completely valid.

 

Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.