> ## 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).

# How to Set Up Google Analytics in Google Tag Manager

Learn how to add the Google Analytics tag to GTM and ensure it respects consent preferences using Pandectes.

### Introduction

Google Tag Manager (GTM) is a powerful tool that allows you to manage and deploy tags, such as Google Analytics, without modifying your Shopify theme code. 

When integrated with **Pandectes GDPR Compliance**, GTM can ensure that tracking scripts only run based on the consent given by your visitors. One of the most commonly used tags in GTM is **Google Analytics**, which provides deep insights into user behavior across your store.

|| If you haven’t integrated GTM with Pandectes yet, check out our [GTM integration guide](https://help.pandectes.io/en/article/integration-with-google-tag-manager-official-pandectes-template-6dbjz/).

---

### Step-by-Step Guide to Add Google Analytics in GTM

#### Step 1: Open Your GTM Workspace

* Visit [https://tagmanager.google.com](https://tagmanager.google.com)  
* Sign in with your Google Account  
* In the **Accounts** tab, select your container  
* Under **Workspaces**, go to **Tags** and click **New**

#### Step 2: Configure the Google Analytics Tag  

In the tag setup panel:

1. Name your tag (e.g., `GA4 Config`)  
2. Click **Tag Configuration**  
3. Select the **Google Analytics** tag type from the Featured Tags section and choose **Google Tag**  
4. In the **Tag ID** field, enter your GA4 ID (e.g., `G-XXXXXXX`)  
5. *(Optional)* If you're using a custom pixel for page views:  
* Click **Add Parameter** under Configuration Settings  
* Set parameter name to: `send_page_view`  
* Set value to: `false`  
6. In the **Triggering** section, choose **Initialization – All Pages**

#### Step 3: Save and Publish  

* Click **Save**  
* Then click **Submit** to publish the tag live on your store