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.

 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

  1. Go to the Data Pipelines tab and click Connections.

  2. Click Add New under Destinations.

  3. Select the Google Tag Manager (GTM) destination.

  4. (Optional) Select the sources that you want to connect to this destination. You can always connect sources to your destination later. We’ll only show you eligible sources.

  5. Configure your destination.

    1. Container ID: The Container ID is available in your Tag Manager Accounts Page.

    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&gtm_auth=xxxxxx

  6. Click Enable Destination.

Beginning March 6, 2024, Google requires your users’ consent to collect their data and personalize ads in conformance 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. You cannot manage consent for this destination within Data Pipelines.

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

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

When you’re done setting up your destination, you can go to the Actions tab to see how we map source events to your destination.

You may need to add actions for this destination

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 destination. See our actions page for help setting up actions.

ActionDefault TriggerDescription
Track Event

type = “track”

Track an event
Track Page View

type = “page”

Track the current page

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

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

Standalone GTMData Pipelines
gtag('event', 'login', { first_name: 'Alex' });
analytics.track('login', { first_name: 'Alex' });
Copied to clipboard!
  Contents
Is this page helpful?