# Google Tag Manager

GTM is an important tool for any online businesses looking to better understand how their customers come into contact with, and engage a website. It works by sending Events to Google Analytics. As such, in order to use GTM, you must first setup [Google Analytics](/managing-your-site/settings/integrations/google-analytics.md).

## How it Works

Once configured, you'll be able to track a number of [Events](https://support.google.com/analytics/answer/9267735), as described below. Some events may have properties attached to them. For example the viewed cart event will have the cart currency, and value. These properties (if available) will be listed below the description within each event.

#### Single Purchases

<details>

<summary>add to cart</summary>

Triggered when the "Add to Cart" button is clicked any any piece of sellable content.

* currency
* value

</details>

<details>

<summary>remove from cart</summary>

Triggered when an item is removed from the cart, on the cart screen.

* currency
* value

</details>

<details>

<summary>viewed cart</summary>

Triggered when the cart is viewed.&#x20;

* currency
* value

</details>

<details>

<summary>begin checkout</summary>

Triggered after a user completes step one (Creating Account) of the checkout process.

* currency
* value

</details>

<details>

<summary>purchase</summary>

Triggered when a user completes the purchase of a digital product.

* currency
* value
* transaction id

</details>

#### Recurring Subscriptions

<details>

<summary>viewed subscribe</summary>

Triggered when a user views the *subscribe* page.

</details>

<details>

<summary>selected plan</summary>

Triggered after a user has selected a plan.

* plan

</details>

<details>

<summary>begin subscription checkout</summary>

Triggered after a user completed step one (create account) of the subscription checkout process.

* currency
* value
* plan
* gateway (stripe or paypal)

</details>

<details>

<summary>subscribed</summary>

Triggered when a user subscribes to a plan and views the welcome-customer page.&#x20;

* currency
* value
* plan
* gateway

</details>

#### Other

<details>

<summary>search</summary>

Fired when after the search form is submitted.&#x20;

* search term

</details>

## Setup

If you haven't previously setup an account with Google Tag Manager, navigate to [this URL](https://tagmanager.google.com/) and start by creating an account. Select "Web" as the platform type.

![](/files/9D0FvGwL4xFee2He3yWk)

You'll be presented with a screen prompting to install Google Tag Manager. Click "OK" to exit out of this prompt. Locate your GTM ID at the top of the page, and copy it to your clipboard.

Next, navigate to the Settings section of your Mavenseed site, then to the "Integrations" tab (admin/settings/integrations), and fill in the ID for Google Tag Manager.

![](/files/ZFPkLHL5SxOEHnGGMhwJ)

## Configuration

The only thing left to do is to configure GTM and GA. GTM works by using Tags, Triggers, and Variables. Here's a link with more information on that. We recommend at least being familiar with the terms and their meanings.

<https://support.google.com/tagmanager/answer/6103657?hl=en>

#### Google Tag Manager

Luckily GTM allows us to Export and Import these things, so we've got a file here that you can upload which will set everything up in a single shot.

1. Click the "Admin" tab in Google Tag Manager, then select "Import Container."

![](/files/sodtRvjwhR23D4m0nEJ8)

2\. Choose "Existing" as the Workspace.

3\. For the Import Option, if this is a new account, you can safely choose "Overwrite" because you haven't set anything up yet. Otherwise, select "Merge."

4\. Download and unzip the file below.

5\. Click "Choose container file" and upload .json file.

{% file src="/files/GP97ysBOeM9vtfoRwRyg" %}

6\. You will be shown a display like below, which is letting you know of all the tags, variables, and triggers that the above file will import. Go ahead and click "Confirm."

![](/files/OvAn1TkHNCrQ5fP8voG1)

6\. <mark style="color:red;">**IMPORTANT!**</mark> This step is very important and should not be skipped. You need to copy over your Google Analytics ID and paste it into the configuration tag for GTM. First, click the "Tags" item on the left menu, then find the GA4 tag (Google Analytics: GA4 Configuration).

Click GA4.&#x20;

![](/files/NAflhZn4XAHc5Ju7UFHp)

On the next screen, locate the measurement ID of G-XXXX.&#x20;

![](/files/wLw5wunMjLR7eujz2mQu)

You will need to paste in your Google Analytics Measurement ID into this field. You can find that by going to your Google Analytics property, clicking "Admin" (the gear icon on the lower left), then clicking Data Streams.

![](/files/otb9n5XLFvmhlLquiv8i)

Locate your stream (you probably only have one), and click on it. On the panel that opens, you can locate your Measurement ID in the upper right hand corner.&#x20;

![](/files/GHzpwyksqHkCvPgEWal7)

Paste this ID into the Measurement ID field on the tag, within Google Tag Manager.

7\. Last step! **Submit** your changes. Google Tag Manager works using Versions so that you can access the things you did in the past.&#x20;

![](/files/AN1SrCzUWybhpyeS7U3u)

You should be set! You should start to see events within Google Analytics within 24 hrs.

#### Google Analytics

After 24 hrs you should start to see events within Google Analytics. The only thing to do in Google Analytics is to set the "subscribe" event as a conversion. This means that, out of all of the Events tracked for the Subscription funnel, "subscribing" is what we want the user to end up doing. So, it's setup as the conversion event.&#x20;

1. Open up GA and navigate to Configure, then Events.
2. Toggle the option to mark "subscribe" as a Conversion Event.

![](/files/eTb5Z1rVD8gF8gnJ62ks)

## Accessing Events

After you've configured GTM, you can access your events from within Google Analytics. Sometimes they will take a while to start populating, but you will eventually see them starting to come in under Reports / Engagement / Events.

![](/files/BA4IiCRvhk8Yw86jDhPg)


---

# 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.mavenseed.com/managing-your-site/settings/integrations/google-tag-manager.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.
