# Google Tag Manager (GTM) Destination

## About this integration

Google Tag Manager is a tag management system that allows you to quickly and easily update tags and code snippets on your website or mobile app. Once the Tag Manager snippet has been added to your website or mobile app, you can configure tags via a web-based user interface without having to alter and deploy additional code.

[Mode How we forward source data to the destination: through Customer.io's servers or directly from our JavaScript client.](/cdp/destinations/getting-started/#connection-mode)

[Web sources Indicates whether or not this integration supports our the JavaScript client.](/cdp/sources/getting-started/#types-of-sources)

[API sources Indicates whether or not this integration supports our server libraries (Go, NodeJS, Python), API, Mobile SDK, and other data sources.](/cdp/sources/getting-started/#types-of-sources)

[Supported calls The API methods this integration supports.](/cdp/sources/source-spec/source-events/)

[Integration name The name of this integration if you want to enable or disable it in the `integrations` object.](/cdp/sources/source-spec/common-fields/#the-integrations-object)

Web

[track](/api/cdp/#operation/track) and [page](/api/cdp/#operation/page)

google-tag-manager

 Don’t use both the GTAG and GTM destinations

Using both the Google Tag Manager and Google Ads (GTAG) destinations on the same page, with the same pixel ID, will likely result in duplicate events.

## Getting started[](#getting-started)

1.  Go to **[Data & Integrations > Integrations](https://fly.customer.io/workspaces/last/journeys/integrations/all/directory)** and select the **Google Tag Manager (GTM)** entry in the *Directory* tab.
    
2.  (Optional) Select the data sources that you want to connect to your outbound integration. You can always connect data sources later. We’ll only show you data sources that work with your integration.
    
3.  Configure your integration.
    
    1.  **Container ID**: The Container ID is available in your Tag Manager [Accounts Page](https://www.google.com/tagmanager/web/#management/Accounts/).
        
    2.  **Data Layer Name**: Customize the name of the data layer object. Useful if you have multiple containers on the same page. Will default to `dataLayer` if not specified.
        
    3.  **Environment**: Optional preview environment (the `gtm_preview` parameter). Important: make sure the string includes gtm\_auth. For example, your string should look like `env-xx&amp;gtm_auth=xxxxxx`
        
4.  Click **Enable Destination**.
    

### Consent management[](#consent-management)

Beginning March 6, 2024, Google requires your users’ consent to collect their data and personalize ads in conformance with the [Digital Markets Act](https://blog.google/outreach-initiatives/public-policy/building-for-compliance-with-the-digital-markets-act/).

With other Google destinations, you can manage consent within settings and actions. But for Google Tag Manager, you must manage constent within your [GTM settings](https://support.google.com/tagmanager/answer/10718549?hl=en#tag-settings). You cannot manage consent for this integration within Customer.io.

### Custom data layer[](#custom-data-layer)

The **Datalayer name** setting is helpful if you use multiple instances of Google Tag Manager on your site. You can set separate data layer names for your different GTM destinations so that you don’t duplicate events across your GTM instances.

### Preview environment[](#preview-environment)

If you use Google Tag Manager in *Preview and Debug Mode* to test your events, you can enter the preview environment ID in the **Preview environment** setting. This ensures that we send events to the correct GTM container when you use *preview and debug mode*.

## Actions[](#actions)

When you’re done setting things up, you can go to the *Actions* tab to see how we map incoming data to your integration.

You may need to add actions for this integration

While we often have default triggers for actions, we don't always add those actions as defaults. You may need to add actions to make sure that you're sending all the data that you want to send to your integration. See our [actions](/integrations/data-out/actions/) page for help setting up actions.

Action

Default Trigger

Description

Track Event

`type = “track”`

Track an event

Track Page View

`type = “page”`

Track the current page

## Tracking page views[](#tracking-page-views)

By default, this destination tracks all page views. But you may want to track only certain page views—like categorized or named pages. If this is something you want to do, you’ll want to update the trigger for the `page` action.

To track categorized pages, you’ll want to update the trigger to fire when the `category` property is present on the page call.

To track named pages, you’ll want to update the trigger to fire when the `name` property is present on the page call.

## Migrating from standalone GTM[](#migrating-from-standalone-gtm)

If you previously used Google Tag Manager in your environment and are moving to Customer.io, your calls will follow a similar format. Where you likely used to call `gtag('event', 'event-name', {})`, you’ll now call `cioanalytics.track('event-name', {})`

Standalone GTM

Customer.io

```javascript
gtag('event', 'login', { first_name: 'Alex' });
```

```javascript
cioanalytics.track('login', { first_name: 'Alex' });
```