> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.pandectes.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Integration with Google Tag Manager (GTM) - Official Pandectes Template

### Overview

The [Pandectes GDPR compliance](https://apps.shopify.com/gdpr-cookie-consent) app offers an official template in [Google Tag Manager](https://tagmanager.google.com/gallery/#/owners/pandectes/templates/gtm-templates-cmp-shopify) (GTM) to integrate the cookie consent banner with it. This allows you to handle **Google Consent Mode V2** inside the Google Tag Manager and manage your tags to run according to user consent.

| When you publish our GTM Template then make sure Pandectes banner is active in order the appropriate signals to fire inside GTM. If you only publish the Pandectes GTM template and you have the Pandectes banner inactive, then all Tags will be blocked inside GTM by the default event, which by default sends a deny.

### Video Guide
${youtube}[Connect Pandectes with GTM (Official GTM template)](CTV_DVUNUQM)

**Prerequisites**

1. The cookie banner is active.
2. You are on the **Plus** plan or higher. On the Basic plan the template does not receive consent updates.
3. Your GTM container loads in **one** of these two ways:
    * **From Pandectes (recommended):** the **Google Consent Mode** integration is on, your container ID is in **Google Tag Manager ID**, and **I have added Pandectes CMP tag to the GTM container.** is selected. See Step 4 below.
    * **From your theme:** the GTM snippet is in `theme.liquid` and the **Google Consent Mode** integration in Pandectes is turned off.

Not sure which one fits your store? See [How to set up Google Tag Manager with Pandectes](/en/article/how-to-set-up-google-tag-manager-with-pandectes-1w5g3hv/).

### Step 1: Adding template from gallery

Go to GTM's templates, then click on Search Gallery.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-4.png =900xauto)

Search for **Pandectes**, and select the **Pandectes CMP (Consent Mode)**.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-5.png =900xauto)
 Then click on **Add to Workspace**.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-6.png =900xauto)
Then confirm, by clicking **Add**.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-7.png =900xauto)
You have now successfully added the template! 

### Step 2: Creating tag from template

Go to the Tags, and create a new tag.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-8.png =900xauto)
 Name it **Pandectes Consent**. Click on **Tag Configuration** and select the **Pandectes CMP (Consent Mode)**.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-9.png =900xauto)
Leave all the options as-is - Then click on **Triggering**.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-10.png =900xauto)
On the trigger, select **Consent Initialization - All pages**.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-11.png =900xauto)
Then the tag is ready! Now, we can assign consent categories to our other tags.

### Step 3: Assign consent categories to your tags

Open the tag that you would like to assign consent to.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-12.png =900xauto)
Click on **Tag Configuration** then **Advanced Settings.**

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-13.png =900xauto)
Select **Consent Settings (BETA)** and Choose the **Require additional consent for tag to fire**. Then, click on **Add required consent**.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-14.png =900xauto)
From the dropdown, select the consent mode category that you want to assign to the tag, so that it fires when that category is accepted.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-15.png =900xauto)
For your convenience, here is a table with the google consent mode Categories, corresponding to the Cookie banner Categories.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-16.png =900xauto)
For example, if we want the tag to fire when the Performance cookies are allowed, we would choose analytics_storage: 

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-17.png =900xauto)
Save the new tag settings, and that's all! The tag will only fire whenever consent is given to it.

### Step 4: Finish the setup in Pandectes

Skip this step if your GTM container loads from `theme.liquid`.

1. In Shopify Admin, go to **Apps > Pandectes GDPR > Integrations**. On the **Google Consent Mode** card, click **Configure**.

    ![Configure button on the Google Consent Mode card](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-1.png =900xauto)

2. Turn on the **Google Consent Mode** toggle.

    ![Google Consent Mode toggle](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-2.png =900xauto)

3. Enter your container ID in **Google Tag Manager ID**, select **I have added Pandectes CMP tag to the GTM container.**, and click **Save**. Pandectes then loads your container and the Pandectes CMP tag handles consent for every tag in it. Remove the GTM snippet from `theme.liquid` so the container does not load twice.

    ![Google Tag Manager ID field and Pandectes CMP tag checkbox](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-3.png =900xauto)

### OPTIONAL Pro tip - if you have many tags

This is a method to add a consent category to multiple tags - to save time.

Go to the Admin panel, and choose Container Settings
![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-18.png =900xauto)
Make sure the **Enable consent overview** is selected: 

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-19.png =900xauto)
Then, in your Tags, select the Shield Icon: 

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-20.png =900xauto)
This will open the **Consent Overview** Panel. Choose the tags that you want to assign a consent category to, and click on the **Shield** Icon.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-21.png =900xauto)
Assign consent just like we did before.

![Screenshot](https://images.pandect.es/knowledge-base/integration-with-google-tag-manager-gtm-official-pandectes-template-22.png =900xauto)