# Google Analytics 4

This Integration requires Fides Cloud or Fides Enterprise. For more information, [talk to our solutions team. (opens in a new tab)](/content/speak-with-us?utm_source=docs-site/index.html)

[Google Analytics 4 (opens in a new tab)](https://developers.google.com/analytics/devguides/collection/ga4) is a web analytics service that helps companies track and analyze website performance and user behavior.

## Prerequisites [Permalink for this section](/content/docs/integrations/saas-integrations/google-analytics#prerequisites/index.html)

There are two ways of authenticating to Google Analytics 4: using [OAuth2](/content/docs/integrations/saas-integrations/developer-reference/saas-oauth2/index.html) or using a [Google Service Account](/content/docs/integrations/saas-integrations/developer-reference/saas_google_service_account/index.html).

### OAuth2 Authentication [Permalink for this section](/content/docs/integrations/saas-integrations/google-analytics#oauth2-authentication/index.html)

OAuth 2.0 must be configured ahead of time to authorize requests against this service. To learn more follow [this guide from Google Analytics (opens in a new tab)](https://developers.google.com/analytics/devguides/reporting/core/v4/authorization).

In order to [integrate](/content/docs/integrations/index.html) with Google Analytics 4 using OAuth 2, you must complete the following steps:

- Enable authorization using [Google OAuth 2.0 (opens in a new tab)](https://developers.google.com/analytics/devguides/reporting/core/v4/authorization).
- Configure the Google OAuth Consent Screen and add the `https://www.googleapis.com/auth/analytics.edit` scope to your app. Steps for this can be found in the _User Consent_ section of [this guide (opens in a new tab)](https://support.google.com/cloud/answer/6158849?hl=en#zippy=%2Cpublic-and-internal-applications).

Once you have this configured, you'll need to collect the following information:

| Name | Description |
| :-- | :-- |
| **Client ID**\* | The OAuth 2.0 client ID for your application. See Google docs for creating [OAuth client ID credentials (opens in a new tab)](https://developers.google.com/workspace/guides/create-credentials#oauth-client-id) |
| **Client secret**\* | The OAuth 2.0 client secret. See Google docs for creating [OAuth client ID credentials (opens in a new tab)](https://developers.google.com/workspace/guides/create-credentials#oauth-client-id) |
| **Redirect URL**\* | The Fides URL to which users will be redirected upon successful authentication (ex. `https://fides-host.com/oauth/callback`) |
| **Property ID**\* | Your GA4 Property ID. See Google's guide on [Property ID's (opens in a new tab)](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). |

### Google Service Account Authentication [Permalink for this section](/content/docs/integrations/saas-integrations/google-analytics#google-service-account-authentication/index.html)

A Google Service Account must be configured ahead of time with the appropriate permissions. To learn more follow [this guide on creating service accounts (opens in a new tab)](https://cloud.google.com/iam/docs/service-accounts-create).

In order to [integrate](/content/docs/integrations/index.html) with Google Analytics 4 using a Google Service Account, you'll need to extract the following information from your [service account JSON key file (opens in a new tab)](https://cloud.google.com/iam/docs/keys-create-delete):

| Name | Description |
| :-- | :-- |
| **Property ID**\* | Your GA4 Property ID. See Google's guide on [Property ID's (opens in a new tab)](https://developers.google.com/analytics/devguides/reporting/data/v1/property-id). |
| **Project ID**\* | Your Google Cloud project ID from the JSON key file. |
| **Service Account Email**\* | The service account email from the JSON key file (e.g., `my-sa@my-project.iam.gserviceaccount.com`). |
| **Private Key**\* | The RSA private key from the JSON key file (begins with `-----BEGIN PRIVATE KEY-----`). |

## Integrating with Google Analytics [Permalink for this section](/content/docs/integrations/saas-integrations/google-analytics#integrating-with-google-analytics/index.html)

To integrate an existing system with Google Analytics:

1. Navigate to **Data map** → **View Systems** and choose the system that you want to connect.
2. Click on the **Integrations** tab.
3. Pick the vendor or system type that you want to integrate with from the **Connection type** drop-down menu.
4. Complete the required fields for the integration and click **Save**.

To authorize the integration so that it can connect to Google:

1. Click on **Authorize integration** to be redirected to the Google authorization screen.
2. Enter your credentials and click **Log in**. You will automatically be redirected back to the Fides UI using the `Redirect URL` that was provided in the form in the previous step.

You may now confirm your connection is working using the **Test connection** button, if desired.

To learn more, please see our guide for [Managing Integrations](/content/docs/integrations/guides/manage-integrations/index.html).

## Technical detail [Permalink for this section](/content/docs/integrations/saas-integrations/google-analytics#technical-detail/index.html)

Fides utilizes _API endpoints_ to access the _API service_ for a SaaS application. An _API service_ is the programmatic interface through which Fides can query and update data within an application to access, rectify, or delete personal information. Each SaaS tool will have a unique set of endpoints to enable privacy functions.

### Google Analytics Endpoints [Permalink for this section](/content/docs/integrations/saas-integrations/google-analytics#google-analytics-endpoints/index.html)

In the table below, you can find which endpoints are used for each type of privacy function. Clicking on the endpoint will take you to the documentation for that endpoint.

| Privacy function | Endpoint | Description |
| --- | --- | --- |
| **Consent Requests** | [Submit User Deletion (opens in a new tab)](https://developers.google.com/analytics/devguides/config/userdeletion/migration) | Used to delete the user from Google Analytics upon opt-out |
