# Via Google Tag Manager

If you wish to activate Google's Basic Consent Mode via Google Tag Manager (GTM) to have more control over its behavior or to load the Sirdata CMP scripts from GTM, for example, this is entirely possible.

Go to your [GTM account](https://tagmanager.google.com/), navigate to the "Templates" section, and click on "Search Gallery" in the "Tag Templates" table.

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FSyRhjE9R9y79dblSZCLL%2Fimage.png?alt=media&#x26;token=f41fef50-9f0e-439d-9268-064815e5b8d9" alt=""><figcaption></figcaption></figure>

Search for "Sirdata CMP | Google Consent Mode"

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FLsrrsA6KWJ34Zg5Vdb8b%2Fimage.png?alt=media&#x26;token=954a71ef-4f61-4d4b-a4fe-e4a2b59f8c45" alt=""><figcaption></figcaption></figure>

Add the "Sirdata CMP | Google Consent Mode" template to the workspace.

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2Fx7wiZJjq3jw2c1nQovln%2Fimage.png?alt=media&#x26;token=91fd78b6-141a-4eb5-bc5b-6a5a1ae6caef" alt=""><figcaption></figcaption></figure>

Go to the "Tags" section, then create a new tag by selecting the new tag type "Sirdata | Google Consent Mode" which now appears in the custom tags :&#x20;

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FPtvteYvrxm3lrBoSegJZ%2Fimage.png?alt=media&#x26;token=5be5e823-1fa3-4644-9e92-c0870ac2e462" alt=""><figcaption></figcaption></figure>

In the configuration section, click on ![](https://cmp.docs.sirdata.net/~gitbook/image?url=https%3A%2F%2F2240931758-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUspPnkTFMlMDdGxvAb-2584506019%252Fuploads%252FQdtOYBgkhkSpsbMk05Ni%252Fimage.png%3Falt%3Dmedia%26token%3Dca1ca138-fc0a-4b31-926d-de8b526d5b58\&width=300\&dpr=4\&quality=100\&sign=1e0b79b7\&sv=1) to add a configuration:&#x20;

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FOUk1TPGdTDYhq3z1Cmuq%2Fimage.png?alt=media&#x26;token=d600106e-b867-475c-9de6-88b45c5daf14" alt=""><figcaption></figcaption></figure>

Select your criteria or keep the default suggestion (Refer to the official [Google Consent Mode page](https://support.google.com/analytics/answer/9976101?hl=en) for more information on these criteria if needed) :&#x20;

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FfJCb35LRcP1OBD2NeqqH%2Fimage.png?alt=media&#x26;token=e5955587-24eb-46f0-95ee-9c600590e7e2" alt=""><figcaption></figcaption></figure>

Repeat the operation if necessary, for example, if you are making configurations differentiated by country. Click here for more information on these criteria.

Then configure your advanced options and enter your partner and configuration IDs if you wish to load the CMP from GTM :&#x20;

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2F8C21k3vOFoSKRkn7lFh7%2Fimage.png?alt=media&#x26;token=2ab0cfe8-eefa-46e9-9c75-f0853a74734c" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you do not load the Sirdata CMP from GTM, it is mandatory to load it from the site, and the CMP scripts must be loaded before the Tag Manager.
{% endhint %}

Finally, select the trigger *"Consent Initialization - All Pages"* and  ![](https://cmp.docs.sirdata.net/~gitbook/image?url=https%3A%2F%2F2240931758-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MUspPnkTFMlMDdGxvAb-2584506019%252Fuploads%252FuHUGijsyoVnfdyHKHtgk%252Fimage.png%3Falt%3Dmedia%26token%3D5e304641-9beb-4e08-ae13-cef0f3b89636\&width=300\&dpr=4\&quality=100\&sign=585b2bd6\&sv=1)<br>

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FNZ2LypMDNAok5fJIXdgG%2Fimage.png?alt=media&#x26;token=110be7f6-848e-46c0-97bd-5ebb45c17944" alt=""><figcaption></figcaption></figure>

Test using the preview mode, and publish if everything works as expected.

To complete the configuration of Basic Google Consent Mode, you need to condition the Google tags (Google Analytics, Google Ads, Google Floodlight, etc.).

**a) Conditioning Google Analytics**

* Create a Custom Event trigger with "sirdataConsent" in the "Event Name" field.
* Create a data layer variable named "sirdataExtraVendors".

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FHfZBE7Ygyt6VjWENEBZz%2Fimage.png?alt=media&#x26;token=7c6c1c30-83e9-4812-b93f-3a6cabddc533" alt=""><figcaption></figcaption></figure>

* Add the "sirdataExtraVendors" variable to your trigger by setting it to "contains" and the ExtraVendor ID "|8|".
* Add a second data layer variable named "sirdataPurposes" :&#x20;

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FoQcTOIE56PMnMfJX8dFC%2Fimage.png?alt=media&#x26;token=096459b4-909d-4e09-ad12-4f695d478e85" alt=""><figcaption></figcaption></figure>

* Add 3 variables 'sirdataPurposes' for purposes |1|, |8|, and |9| as follows:

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FKW59mPVImLMvs5JtoFu2%2Fimage.png?alt=media&#x26;token=454a5f30-6f99-44a1-ae91-b2f106e771cd" alt=""><figcaption></figcaption></figure>

* To finish, add your "sirdataConsent Google Analytics" trigger to your GA4 tag :&#x20;

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FAJFK9NTau4lsJuPUc8RY%2Fimage.png?alt=media&#x26;token=1898474c-c7c7-45f4-bdaf-e98240de1527" alt=""><figcaption></figcaption></figure>

#### b) Conditioning Google Ads

* Create a custom event trigger with "sirdataConsent" in the "Event Name" field.
* Create a first data layer variable named "sirdataVendors" :&#x20;

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FfilXmCWYP8RbKQwdbaGj%2Fimage.png?alt=media&#x26;token=f596f353-b6d6-4e0d-a708-59b0973b3991" alt=""><figcaption></figcaption></figure>

* Add the variable "sirdataVendors" to your trigger by setting it to "contains" and the Vendor ID "|755|".
* Add a second data layer variable named "sirdataPurposes":

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2Fwcurvk97CN8nebxs6i4b%2Fimage.png?alt=media&#x26;token=8014bc20-0b1c-490c-87d6-399f6ce22de4" alt=""><figcaption></figcaption></figure>

* Add 3 custom events 'sirdataPurposes' for purposes |1|, |3|, and |4| as follows :&#x20;

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2FVBBR1bhI1Zg6r0bV8R4l%2Fimage.png?alt=media&#x26;token=e0fbbf9f-6ed7-44d1-a674-a5550cdf2231" alt=""><figcaption></figcaption></figure>

To finish, add your "sirdataConsent Google Advertising Products" trigger to your Google Ads tag:

<figure><img src="https://1869615683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MUspPnkTFMlMDdGxvAb-1972196547%2Fuploads%2F6s3j6N4ZiBOGAUrEQ9Eb%2Fimage.png?alt=media&#x26;token=47c90f24-9a86-46a6-b1d4-1a9233f03f0c" alt=""><figcaption></figcaption></figure>
