---
title: Install Google Tag Manager
slug: configured-commerce/docs/install-google-tag-manager
docTags: 
createdAt: 2026-08-13T10:46:19.000Z
---

As an Optimizely Configured Commerce user, you can install Google Analytics 4 or a Google Tag Manager container on your various websites and domains. Follow the steps below to implement Google Tag Manager.

:::hint{type="info"}
**Note**

You need the ISC\_Implementer role to make these changes.
:::

## Locate the Google Tag Manager Container ID

Find the unique Google Tag Manager Container ID (**GTM ID**) and the domains in which you want that tracker installed. Configured Commerce then places the Google Tag Manager snippet with your provided GTM ID in the correct locations on your site and installs the data layer for future use. 

1. Sign in to your [GTM account](https://tagmanager.google.com/#/home).
2. Expand **All accounts** and select the appropriate container. The container ID displays at the top of the page.

   ![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/yLA0G-F7Mzq1Mz1T6qaSF-20260720-144547.png)

## Update the Google Tracking Settings

Google Analytics requires you to configure three settings:

- **Google Tracked Domains** – A list of domain names that have Google Tracking enabled for B2B Analytics. Include the fully qualified domain, which is anything between the *https\://* and the next /. For example, [www.mydomain.com](http://www.mydomain.com).
- **Google Tracking Account ID** – The GTM ID of the container you want to install.
- **Google Tracking Type** – The tracker you have decided to use. Options: **GoogleTagManager** or **Google Analytics 4**

:::hint{type="info"}
**Note**

For Spire sites, be sure to add the domain name (non-url) to the GTM settings.
:::

Follow these steps to update the settings in Configured Commerce:

1. Go to the **Admin Console** > **Administration** > **Settings**.
2. Enter *google track* into the Search Box to see three settings under **System Settings**.

   ![googletrack_adminconsole.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/r2HVF0AyHOhk5QQnC1WCU-20260720-144547.png)
3. Click **System Settings**.
4. Set the following options under **Analytics**:
   - **Google Tracking Type** – Select **Google Tag Manager**.
   - **Google Tracked Domains** – Enter the website URL as defined on the websites page for that specific site.
5. Click **Add More** to add additional domains (for Spire clients to set 2 entries for tracked domains).

   - The customer-facing URL (not the integration URL)
   - The commerce “website name” (See example below)
   - The GTM Tracking ID from Google Tag Manager

   ![AdditionalDomains_GTM.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/cJZnb4INWndJShPQS0LJ--20260720-144547.png)
6. Save your changes.

   ![GTM_Admin Console.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/N9cE1E2Ug_isyoxMIcrVV-20260720-144547.png)

## Enable applicable settings in Google Analytics

To capture the data and the custom dimensions, you must enable both in the settings of Google Analytics.

### Enable ecommerce

1. Log in to the applicable Google Analytics view.
2. Go to **Admin**.
3. Turn on the **Status** slider under **Ecommerce Settings** > **Enable Ecommerce**.
4. Leave the remaining fields off (optional).
5. Repeat this process for all views you wish to capture data.

### Enable custom dimensions

1. Go to **Property Settings** > **Custom Definitions** > **Create Custom Dimensions** in Google Analytics.
2. Add the following custom dimensions:
   1. **Authentication State** – Set the **Scope** to **Hit**.
   2. **User ID** – Set the **Scope** to **Hit**.
   3. **Session ID** – Set the **Scope** to **Session**.
   4. **item\_ID** – Set the **Scope** to **Item**.
   5. **item\_name** – Set the **Scope** to **Item**.

The custom dimension **Index number** should match how they are configured on your Google Analytics tag inside Google Tag Manager.

### Enable Site Search Tracking in Google Analytics (optional)

You may also enable Site Search Tracking in Google Analytics to understand visitor engagement metrics for the search box on your site. This setting captures metrics such as percentage of sessions with search and all keywords that have been searched.

1. Go to the **View Settings** for the Google Analytics view you are using with Configured Commerce.
2. Turn on **Site Search Tracking**.
3. Enter **criteria** as the **Query Parameter**.
4. Save your changes.
5. Repeat this process for all views you wish to capture Site Search data.

![mceclip1.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/0RGPwnc3MedTLOw2fSTX8-20260720-144547.png)

## Import new tags

1. Sign in to your Google Tag Manager account.
2. Click Admin in the top menu.
3. Go to **Container** > **Import Container**. Import the **ga4-container-purchase.json** file at the bottom of the article.
4. Select **Existing workspace** > **Default Workspace**.
5. Select **Merge and Rename conflicting tags, triggers, and variables**. Click **Confirm**.
6. Click **Tags** in the left menu.
7. Click on the **GA4 - Purchase tag**. Ensure that the Measurement ID matches your Google Analytics account. If not, click the **Edit** icon, and update the Measurement ID. Click **Save**.

   :::hint{type="info"}
   **Note**

   If you do not know how to get the Measurement ID, see[ Install Google Analytics 4](docId\:CfMgsDBbnFxzOrj_LZKhB).
   :::
8. Click **Submit**.
9. Put today's date under **Version Name** so you can track when these changes were published.
10. Click **Publish**.

## Configure tags, triggers, and variables in Google Tag Manager

You can configure the tags, triggers, and variables Configured Commerce uses in Google Tag Manager.

**Variable - Authentication State**

![mceclip2.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/_JQEznKfBf8XsFRJxg1rD-20260720-144547.png)

**Variable - User ID**

![mceclip3.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/sXK6r9C0dSKozmFRevEO--20260720-144547.png)

**Variable - Session ID**

![mceclip4.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/zJQKtmoYfrHtSo1Ga0SNb-20260720-144547.png)

**Variable - Measurement ID**

Replace the Tracking ID with your own Measurement ID in the Google Analytics Admin page.

![mceclip5.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/vnGAxh4lGFLoyEJT9m3aX-20260720-144547.png)

**Trigger - virtualPageview**

![mceclip6.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/UIGtZcPhqHLat6EULBDyb-20260720-144547.png)

**Trigger - eCommerce Transaction Event**

![mceclip7.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/Kg-8Yu226DZhpeIrD4BlQ-20260720-144548.png)

**Tag - Google Analytics eCommerce**

Replace the Google Analytics Settings in the GA ID variable as listed below.

![mceclip9.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/bgtlU-Hhfqo6deVyc-JZ3-20260720-144548.png)
