# Google Consent Mode V2 Integrated

The Google Consent Mode Integration feature within the app provides a seamless way for merchants to implement Google's Consent Mode on their e-commerce platform. This feature allows merchants to respect user consent for cookies, ensuring compliance with data protection regulations while still enabling the collection of critical analytics and ad performance data.

<details>

<summary>If you need an advanced server-side tracking and Google Tag Manager for Google Ads, GA4, Facebook, TikTok, and more. We recommend app <a href="https://apps.shopify.com/tagfly?utm_campaign=crs&#x26;utm_source=cookies&#x26;utm_medium=document"><strong>TagFly Google Tag Tracking</strong></a></summary>

<img src="/files/QsjO2qviY8agfLLtR7Fv" alt="" data-size="original">

This app help to enhance event tracking with server-side capabilities and a simple Google Tag Manager setup, sending accurate data directly to platforms like GA4, Google Ads, Facebook (Meta), TikTok, and more.

Get this app from [Shopify App Store](https://apps.shopify.com/tagfly?utm_campaign=crs\&utm_source=cookies\&utm_medium=document)

</details>

Merchants can configure Google Consent Mode directly from app's admin: **Settings/Integration/ Google consent mode** by following these steps:

Please check this instruction to be clear:

<figure><img src="https://apps.consentik.com/consentik/admin/dist/images/guides/gcm.gif" alt="" width="563"><figcaption></figcaption></figure>

1. **Consent Parameters Selection**: Choose from the list of consent parameters which ones to apply. Options include:

   * `ad_storage`: Enables storage related to security such as authentication functionality, fraud prevention, and other user protection.
   * `ad_user_data`: Sets consent for sending user data related to advertising to Google.
   * `ad_personalization`: Sets consent for personalized advertising.
   * `analytics_storage`: Enables storage (such as cookies) related to analytics e.g. visit duration.
   * `security_storage`: Enables storage related to security such as authentication functionality, fraud prevention, and other user protection.
   * `functionality_storage`: Enables storage that supports the functionality of the website or app e.g. language settings.
   * `personalization_storage`: Enables storage related to personalization e.g. video recommendations.
   * `ads_data_redaction`:  When ad\_storage is denied, new cookies will not be set for advertising purposes. Additionally, third-party cookies previously set on google.com and doubleclick.net will not be used except for spam and fraud purposes. Data sent to Google will still include the full page URL, including any ad click information in the URL parameters.
   * `url_passthrough`: Passing ad click, client ID, and session ID information in URLs.

   <figure><img src="/files/7yDXS5YFZpBRIYFtnmCV" alt=""><figcaption></figcaption></figure>

Based on the merchant's selection, the app will generate the necessary code snippets. These snippets are designed to be compatible with Consent Mode v1 and v2, adhering to the latest updates as outlined in Google's documentation.

Once the relevant options are selected and the code is generated, merchants can integrate Consent Mode by following these steps:

1. **Code Copying**: Copy the generated code snippet provided by the app.
2. **Theme File Editing**: Access the `theme.liquid` file within the website's theme editor.
3. **Code Pasting**: Paste the copied code snippet just after the opening `<head>` tag.
4. **Save Changes**: Save the changes made to the `theme.liquid` file to ensure Consent Mode is active.

### Default Consent Configuration

Upon integration of the generated code into the `theme.liquid` file, the app will default all Google Consent Mode parameters to a 'denied' state. This ensures that no data is collected without the explicit consent of the user.

### User Consent Interaction

When a user visits the merchant's website, they will be prompted to provide consent for various categories of cookies, including:

* **Marketing Cookies**: Related to advertising and marketing efforts.
* **Analytics Cookies**: Used for collecting data on user interaction and behavior.
* **Functionality Cookies**: Essential for certain website features and personalization.

### Updating Consent Status

If the user provides their consent:

1. **Consent Update**: The app will update Google Consent Mode to 'granted' for the cookie categories the user has accepted.
2. **Consent Storage**: The user's preferences are stored in a cookie on their device, ensuring that their choices are remembered for future visits.
3. **Automatic Consent Application**: On subsequent visits, the app will automatically read the stored cookie and apply the user's preferences without requiring them to consent again.

With this feature, merchants can manage user consent for cookies in a way that is compliant with privacy laws, user-friendly, and minimizes the impact on data collection for critical website functions. The process is designed to be transparent for users and straightforward for merchants to implement and manage.

### Test your Consent mode setup

**Method 1: Using Tag Assistant**&#x20;

If you go to <https://tagassistant.google.com/,> you can debug the consent states for any sites running Google Tags.

After adding the domain that you want to debug, you can choose a Tag ID from the top of Tag Assistant, then choose the first Consent event from the navigation on the left, and select the “Consent” tab to see default value of consent, all of consent types are denied:

<figure><img src="/files/asSoO4rxJR2hd8IwfoIo" alt=""><figcaption></figcaption></figure>

Come back to your website and click to "Accept" button and you can see another consent event is fired. Click to Consent Tab and see the update event

<figure><img src="/files/x7lpuoVLT5FR07x3IgtW" alt=""><figcaption></figcaption></figure>

If you see a warning that “a tag read consent before a default was set”, it means you have a *race condition* where your consent states are not established in time before any tags that reference them have time to fire.

**Method 2: Using Console on DevTool**

1. Open your site
2. Press button **F12** or **`Ctrl + Shift + J`** on Windows ( **`Cmd + Option + J`** on MacOS) or **Right Mouse** and select **Inspect** to open Console Tab on
3. Type **`dataLayer`**
4. When cookie banner show, you can see the default consent event is fired

<figure><img src="/files/cD2kANP7FjJzBkUSBs6I" alt=""><figcaption></figcaption></figure>

5. When you click to "Accept" button, you can see an Update event is fired

<figure><img src="/files/DXCaQXvnAD8DghoOd1U7" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.consentik.com/integrations/google-consent-mode-v2-integrated.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
