Skip to main content

Google Tag Manager (GTM)

Source code Package Browser ES5

The Google Tag Manager (GTM) is a popular tag management solution that allows you to create and update tags for your web and mobile applications.

Configuration

Start by setting up the config for the destination. Destinations can be used via node or directly in the browser.

const config = {
custom: {
containerId: "GTM-XXXXXXX",
dataLayer: "dataLayer",
domain: "https://www.googletagmanager.com/gtm.js?id=";
},
};
PropertyTypeDescription
containerIdstringThe published Google Tag Manager container ID.
dataLayerstringName of the dataLayer array.
domainstringSource domain for the GTM script.

When using loadScript: true the containerId is required.

How to use

Choose one of the installation options below to start using the GA4 destination:

Install the destination via npm

npm i @elbwalker/destination-web-google-gtm
import { elb } from '@elbwalker/walker.js';
import destinationGoogleGTM from '@elbwalker/destination-web-google-gtm';

elb('walker destination', destinationGoogleGTM, config);