diff --git a/src/connections/destinations/catalog/google-tag-manager/index.md b/src/connections/destinations/catalog/google-tag-manager/index.md index f651e6bf04..4fba613f77 100644 --- a/src/connections/destinations/catalog/google-tag-manager/index.md +++ b/src/connections/destinations/catalog/google-tag-manager/index.md @@ -9,15 +9,14 @@ id: 54521fd625e721e32a72eeb9 ## Getting Started -{% include content/connection-modes.md %} 1. From the Segment web app, click **Catalog**. 2. Search for "Google Tag Manager" in the Catalog, select it, and choose which of your sources to connect the destination to. 3. In your Segment UI's destination settings, enter your Container ID (note: it should start with "GTM-"). You can find this in the Admin section of your [GTM dashboard](https://tagmanager.google.com/#/admin/). -4. GTM will be loaded on any pages where your Segment snippet is initialized and `analytics.page` gets called in client-side Javascript. Once you've turned on GTM through Segment, you can use Segment `track` events to populate the GTM `dataLayer`. +4. GTM loads on any pages where your Segment snippet is initialized and `analytics.page` is called in client-side Javascript. Once you've turned on GTM through Segment, you can use Segment `track` events to populate the GTM `dataLayer`, and remove the GTML snippet from your page. **Notes** -* We recommend loading GTM through Segment rather than loading Segment inside of GTM. +* Segment recommends that you load GTM through Segment rather than loading Segment inside of GTM. * Be sure to "publish" your GTM container in GTM before trying to load it through Segment, otherwise your container URL will return a 404 error. @@ -25,22 +24,22 @@ id: 54521fd625e721e32a72eeb9 If you're not familiar with the Segment Specs, take a look to understand what the [Page method](/docs/connections/spec/page/) does. An example call would look like: ```js -analytics.page('Home', { +analytics.page('Home', { title: 'Welcome | My Website', url: 'https://mywebsite.com/' }); ``` -You must call the Page method for Google Tag Manager to load. We already include a call to `analytics.page` in your default Segment snippet, so if you haven't removed that, GTM will work the same as if you installed the GTM snippet directly. +You must call the Page method for Google Tag Manager to load. Segment includes a call to `analytics.page` in your default Segment snippet, so if you haven't removed that, GTM will work the same as if you installed the GTM snippet directly. ### Tracking All Pages -When you turn on the setting to **Track All Pages** in your Optional Settings, we will track events whenever you call our `page` method and send a "Loaded A Page" event to Google Tag Manager. See the `track` section below for more info on how we send events to GTM. +When you turn on the setting to **Track All Pages** in your Optional Settings, Segment tracks events whenever you call the `page` method and send a "Loaded A Page" event to Google Tag Manager. See the `track` section below for more info on how Segment sends events to GTM. ### Named Page Events -If you include a `name` parameter in your `page` calls and turn on the setting to **Track Named Pages** in your Optional Settings, we will also pass on an event to GTM for that page. For example, `analytics.page('Signup')` would translate to a "Viewed Signup Page" event. See the `track` section below for more info on how we send events to GTM. +If you include a `name` parameter in your `page` calls and turn on the setting to **Track Named Pages** in your Optional Settings, Segment passes on an event to GTM for that page. For example, `analytics.page('Sign up')` would translate to a "Viewed Sign up Page" event. See the `track` section below for more info about how Segment sends events to GTM. ### Categorized Page Events -If you include a `category` parameter in your `page` calls and turn on the setting to **Track Categorized Pages** in your Optional Settings, we will also pass on an event to GTM for that page. For example, `analytics.page('Docs', 'Index')` would translate to a "Viewed Docs Index Page" event. See the `track` section below for more info on how we send events to GTM. +If you include a `category` parameter in your `page` calls and turn on the setting to **Track Categorized Pages** in your Optional Settings, Segment passes an event to GTM for that page. For example, `analytics.page('Docs', 'Index')` would translate to a "Viewed Docs Index Page" event. See the `track` section below for more info about how Segment sends events to GTM. ## Track @@ -54,7 +53,7 @@ analytics.track('Article Completed', { }); ``` -When you make a Track call in with GTM enabled through Segment, we will push the event data to the GTM `dataLayer`. +When you make a Track call in with GTM enabled through Segment, the event data is pushed to the GTM `dataLayer`. For example, if you make this `track` call: @@ -65,7 +64,7 @@ analytics.track('Played Video', { }) ``` -We will pass it to the `dataLayer` as an object like this: +Segment it to the `dataLayer` as an object like this: ```json { @@ -86,7 +85,7 @@ If you are seeing `404` error on the javascript console of your page and it is a ## Appendices ### UserId and AnonymousId -By default we will also push the `anonymousId` and `userId`(if exists) into the `dataLayer` for each `page` or `track` call. Since the `anonymousId` is created by Segment, we will namespace that property in the `dataLayer` as `segmentAnonymousId`. +By default Segment pushes the `anonymousId` and `userId`(if exists) into the `dataLayer` for each `page` or `track` call. Since the `anonymousId` is created by Segment, namespaces that property in the `dataLayer` as `segmentAnonymousId`. ### Environments If you're using an 'environment' variable for `gtm_preview` in your tag's query string, you can set that string in the **Environment** of your Optional Settings. IMPORTANT: Make sure the string includes the `gtm_auth` variable. For example, your string should look like: `env-xxxxx>m_auth=xxxxx`.