# Setup with Google Tag Manager (GTM)

### **What is GTM?**

**Google Tag Manager (GTM)** is a service that simplifies the management of tags on your website — such as Google Analytics, Facebook Pixel, or AdWords conversion tracking tags.\
GTM allows you to **add, update, and manage tracking codes** on your site in a more **flexible and user-friendly** way.

### **GTM and Efilli**

By using GTM, you can manage your existing tags alongside the **Efilli plugin**.\
Once you integrate GTM with the **Efilli Panel**, you’ll be able to **categorize the tags** on your website using Efilli’s custom naming convention for GTM, and present them to users **based on consent** through Efilli’s cookie plugin.

For example, a Google tag that adds functionality to your website can be **categorized as a Functional Tag** using GTM and Efilli.\
This way, it will only be triggered for users who have **granted consent for functional cookies**.

### **1. Adding GTM (Google Tag Manager) to Your Website**

1. Go to [**panel.efilli.com**](https://panel.efilli.com) and log in using the **username and password provided by the Efilli team**.
2. From the menu, go to the **“Domains”** section and find the appropriate domain name.
3. Click the **configuration icon** on the right side of the relevant domain to enter the edit mode.
4. Click the **“Prepare Version”** button located at the top right corner.
5. Click the **“Google Tag Manager”** logo that appears at the top right corner of the screen, and download your configuration file.

### 2. Creating an Account via Google Tag Manager

1. Go to <https://tagmanager.google.com/> and sign in with your Google account.
2. If you don’t have an account, select **“Create Account”** to open a new one.
3. Follow the on-screen instructions under **“Install Google Tag Manager”** to add GTM to your website.

### 3. Integrating Efilli via GTM

1. From the top-left corner, select **“Admin.”**
2. Choose **“Import Container.”**
3. Upload the **JSON configuration file** you previously downloaded from the Efilli panel.
4. After importing the container, configure the settings as follows:

* Select **Merge**
* Under that option, choose **Overwrite conflicting tags, triggers, and variables**

5. Click the **Confirm** button to save your changes.
6. The process is complete! Efilli will now start managing all cookie consents on your website.

### 4. Enabling Consent Overview

1. In your GTM account, click on **“Container Settings.”**
2. In the menu that appears, under the **Additional Settings** section, click on **Enable Consent Overview.**
3. To view the tags and templates you’ve created in your GTM account, go to the **Tags** category.
4. Click the **configuration icon** located on the right side.
5. Gain the ability to review all consents from a single place.
6. Select the desired tag or tags, and configure your consents by adding them in bulk to the relevant category.

#### **Category Mapping (Cookie Types and Google Tag Manager Integration)**

Efilli maps its own cookie categories to the consent types required by Google and sends the correct data to the **dataLayer**.\
This mapping determines which information will be transmitted to Google services according to the user's cookie preferences.

The updated mapping is as follows:

* **Advertising and Marketing Cookies** (`ad_storage`) → **Marketing category**
* **Analytics and Performance Cookies** (`analytics_storage`) → **Functional category**
* **Website Functionality Cookies** (`functionality_storage`) → **Functional category**
* **Security and Necessary Cookies** (`security_storage`) → **Necessary category** *(always active)*
* **Personalization Cookies** (`personalization_storage`) → **Functional category**
* **Ad User Data** (`ad_user_data`) → **Marketing category**
* **Personalized Ads** (`ad_personalization`) → **Marketing category**

Thanks to this mapping, the consents provided by users via the Efilli cookie banner are transmitted to Google Tag Manager in the correct format, and the relevant tags are triggered **only when user consent is granted**.

> **Important Note:**\
> If you want to customize specific cookie types, you can modify the category mappings in the **Efilli Panel** and update the corresponding triggers in **GTM**.

***

#### **Advanced Settings (URL Passthrough & Ads Data Redaction)**

The Efilli panel provides two additional advanced settings for **Google Consent Mode V2**:

**URL Passthrough**

If the user arrives at your site through a URL containing Google ad click parameters (such as `gclid`, `dclid`, `gclsrc`, or `_gl`), this setting allows those parameters to be passed along to internal links.\
This feature is **disabled by default**. When enabled, it ensures **more accurate ad conversion tracking**, but may **increase URL complexity**.

**Ads Data Redaction**

When users **do not consent to advertising cookies**, this setting ensures that **Google Ads tags shorten IP addresses** and **mask ad click identifiers** (like GCLID).\
This feature is also **disabled by default** and should be enabled only if you have **additional privacy requirements**.

You can enable or disable both settings in the **Efilli Panel**, depending on your needs.

***

#### **Consent Mode V2 – Basic and Advanced Modes**

Google Consent Mode v2 can be implemented in two different ways: **Basic** or **Advanced**.\
Both implementations control how and when Google tags interact with user consent choices.

The key difference between Basic and Advanced consent mode is **whether Google tags are allowed to load before user interaction with the consent banner**.

**Basic Consent Mode**

In **Basic consent mode**, Google tags are **prevented from loading until the user interacts with the consent banner**.

**How it works**

* Google tags do **not load** when the page is opened.
* No data is transmitted to Google prior to user interaction with the consent banner.
* When the user grants consent:
  * Google tags load.
  * The consent mode APIs are executed.
  * Consent states are sent to Google in the following order:
    1. Default consent states
    2. Updated consent states
* If the user does **not** grant consent:
  * No data is sent to Google at all.
  * This includes consent status itself.
  * Google tags remain completely blocked from firing.

**Measurement impact**

* No cookieless pings are sent before consent.
* Conversion modeling in Google Ads is based on a **general model**, not advertiser-specific data.

**Advanced Consent Mode**

In **Advanced consent mode**, Google tags are allowed to **load as soon as the website or app is opened**.

**How it works**

* Google tags load on page load.
* The consent mode API is executed immediately.
* Default consent states are set (by default, consent may be denied unless configured otherwise).
* While consent is denied:
  * Google tags send **cookieless pings**.
* When the user interacts with the consent banner and grants consent:
  * Consent states are updated.
  * Google tags begin sending full measurement data.

**Measurement impact**

* Cookieless pings allow Google to model conversions before consent.
* This implementation enables **improved modeling** compared to Basic consent mode.
* Conversion modeling is based on an **advertiser-specific model** rather than a general one.

For more detailed information about Google Consent Mode v2, please check out Google's official documentation: <https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced&hl=en>
