Google Tag Manager Device Mode Integration
Send events to Google Tag Manager using RudderStack device mode.
After you have successfully instrumented Google Tag Manager as a destination in RudderStack, follow this guide to correctly send your events to Google Tag Manager in device mode.
Identify
You can use the identify call to identify a user, and send their information like name, email, etc. to Google Tag Manager.
A sample identify call is shown:
rudderanalytics.identify("1hKOmRA4GRlm",{
"name":"Alex Keener",
"gender":"Male",
"city":"New Orleans"
})
The above call populates Google Tag Manager with the following user traits along with their values:
Page
The page call allows you to record whenever a user visits a page of your website, along with the properties associated with that page.

You must call the page event to load Google Tag Manager .
A sample page call is shown below:
rudderanalytics.page("home", {
path: "path",
url: "url",
title: "title",
search: "search",
referrer: "referrer"
});
The above call populates Google Tag Manager with the following properties along with their values:
userIdanonymousIdevent - the viewed home pagepathurltitlesearchreferrer

Making a page call sends out an object to the GTM data layer containing your page-related properties and an event name with its associated value.
Track
The track call lets you record any user actions along with the properties associated with those actions.

You can use the RudderStack track events to populate the Google Tag Manager data layer once you have set up and enabled Google Tag Manager in RudderStack.
Calling the RudderStack SDK track method with the event and its properties similarly passes the data to GTM as seen in the page section above.
rudderanalytics.track("Track me", {
category: "category",
label: "label",
value: "value",
});
The above call populates Google Tag Manager with the following properties along with their values:
userIdanonymousIdeventcategorylabelvalue
Questions? Contact us by Email or on
Slack