# Manage Google Analytics

Google Analytics management is integrated into the CMP using the GCM (Google Consent Mode) protocol. GCM blocks Google Analytics from depositing cookies or scripts before the user consent. The CMP may continue to block Google Analytics after the user's consent, depending on the user's choices.

On this page you'll find information on how to manage Google Analytics with AppConsent, depending on your implementation.

## Implementing and configuring Google Analytics with GTM

### Measurement ID retrieval

Before implementing Google Analytics, you need to retrieve your measurement ID. To do this, you need :

1. Go to on your Google Analytics dashboard <https://analytics.google.com/>
2. In the left-hand side panel, click on **Admin**

<figure><img src="https://4229351976-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkyFlZKFaKP4MUM0zILOg%2Fuploads%2FPV4dZpK5wPAxq8W6agc2%2FGTM-ga-id-admin.png?alt=media&#x26;token=d45675da-ee80-417a-92b1-1fbc783d2cb8" alt=""><figcaption></figcaption></figure>

3. In the page, find the section **Data collection and modification**
4. Then click on **Data streams** menu

<figure><img src="https://4229351976-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkyFlZKFaKP4MUM0zILOg%2Fuploads%2FU9BMtwFp77ycV2ACitO7%2FGTM-ga-id-flow-data-menu.png?alt=media&#x26;token=cc056a2e-5ad7-4e0d-ac96-afbdbb9406fa" alt=""><figcaption></figcaption></figure>

5. Click on data stream you wish to integrate to open the stream details
6. And copy measurement ID using the button

<figure><img src="https://4229351976-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkyFlZKFaKP4MUM0zILOg%2Fuploads%2FzkYADTbMKQHP52M14ML4%2FGTM-ga-id-copy.png?alt=media&#x26;token=a25f9417-7007-412f-a07a-3516a7197788" alt=""><figcaption></figcaption></figure>

### Implementing Google Analytics with GTM

1. Return on Google Tag Manager
2. On the left-hand side panel, click on the **Tags** menu
3. Then click on **New** button

<figure><img src="https://4229351976-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkyFlZKFaKP4MUM0zILOg%2Fuploads%2FMNbLjjJC709zaji9oGXu%2FGTM-ga-new-tag.png?alt=media&#x26;token=8e43b9c9-06dd-44c5-a6a2-b7e2cf03d0e6" alt=""><figcaption></figcaption></figure>

4. Click on **Tag configuration** section
5. Then in the left-hand side panel, select **Google Analytics**

<figure><img src="https://4229351976-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkyFlZKFaKP4MUM0zILOg%2Fuploads%2FcG3mbBeUZfRKNC6Nz9c7%2FGTM-ga-select-tag-ga.png?alt=media&#x26;token=a09bc538-1177-4ddc-843d-71e47cca73b9" alt=""><figcaption></figcaption></figure>

6. The click on **Google tag** template

<figure><img src="https://4229351976-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkyFlZKFaKP4MUM0zILOg%2Fuploads%2FDpF7syykK4fMPpdAUk6F%2FGTM-ga-add-tag.png?alt=media&#x26;token=94c60cc3-118a-4649-9034-0cc587cc6e0f" alt=""><figcaption></figcaption></figure>

7. Paste the previously copied ID (see above) into **Tag ID** field

<figure><img src="https://4229351976-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkyFlZKFaKP4MUM0zILOg%2Fuploads%2FTnAqVC8GxRbalUJ9YMZW%2FGTM-ga-add-id.png?alt=media&#x26;token=ffbe45fb-fd0e-4b16-9a47-e03b4cd3c608" alt=""><figcaption></figcaption></figure>

8. In the accordion **Consent Settings** located in **Advanced Settings**, you can see that your tag is already ready to use Google Consent Mode signals

<figure><img src="https://4229351976-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkyFlZKFaKP4MUM0zILOg%2Fuploads%2F19ReBxEc9LlcXHUXAy4V%2FGTM-ga-consent-types.png?alt=media&#x26;token=23c4b1b9-a4f8-4220-9e75-37889f9a446a" alt=""><figcaption></figcaption></figure>

9. In triggering section, add the **All Pages** trigger

<figure><img src="https://4229351976-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkyFlZKFaKP4MUM0zILOg%2Fuploads%2F7RqOvDTHZ67NSGP2nBOo%2FGTM-ga-trigger.png?alt=media&#x26;token=0089edb4-28ea-40fd-bdb1-6248ae1f2300" alt=""><figcaption></figcaption></figure>

10. Then, name and save the tag

## AppConsent configuration for Google Analytics (Google Consent Mode Advanced Mode - GCMv2)

For Google Analytics to be controlled by the CMP, GCM (Google Consent Mode) must be activated in the notice configuration and in the notice implementation (code or GTM).

For more information on implementing Google Consent Mode, see the page: [Setting up Google Consent Mode v2](https://docs.sfbx.io/configuration/step-3-notice-implementation-web-app-tv/web-cmp/setting-up-google-consent-mode-v2-for-google-analytics-and-google-ads)
