What is Google Tag Manager (GTM), and How Is It Used for MNTN Pixels?
Google Tag Manager (GTM) is a free tool designed to make it easy to manage marketing and analytics tags on your website or app without requiring changes to the codebase. With GTM, you can add, edit, and organize tags—small snippets of code such as the MNTN Pixel. This eliminates the need for ongoing developer involvement, helping you deploy marketing campaigns faster and with fewer errors.
How Does GTM Work?
GTM operates by embedding a small container code snippet on your site. This container acts as a framework to dynamically load tags based on predefined rules. Key GTM components include:
Tags: Code snippets for tracking (e.g., MNTN Pixel or Google Analytics).
Triggers: Conditions that determine when a tag fires (e.g., when a page loads or a button is clicked).
Variables: Data that supports triggers and tags, such as page URLs or user inputs.
You can configure these components within GTM’s interface to manage tracking on your site efficiently.
Steps for Installing the MNTN Pixel with GTM
Add the GTM container to your site.
If GTM has not been installed, you can follow Google’s setup guide.Install the MNTN Pixel tags in GTM.
Use the MNTN Community Template to quickly add and configure your MNTN Pixel.Set up triggers for your MNTN Pixel.
Choose the user actions you want to track (e.g., page views, button clicks, or form submissions) and configure the corresponding triggers in GTM.Check your GTM variables.
Ensure thedataLayer
includes the data your MNTN Pixel requires, such as order details or product information. Much of this data may already be available if you're using Google Analytics.Validate your setup.
Use GTM’s Preview Mode to test that the pixel is working correctly and capturing the expected data.Publish your changes.
Setting Up GTM Triggers for MNTN Pixels
What are triggers?
Triggers are rules or conditions in GTM that determine when a tag fires. For example, you can configure a trigger to fire a tag when a specific page is viewed, a form is submitted, or a button is clicked.
To configure triggers for MNTN pixels:
Decide what actions to track.
Common triggers for MNTN customers include:Page views: For general site tracking or specific pages (e.g., "thank-you" pages).
Clicks: For tracking buttons or links.
Form submissions: For actions like newsletter sign-ups.
Element visibility: For tracking when specific elements, like pop-ups, become visible.
Set the trigger type and conditions.
For example, to track clicks on a button with the IDsubmit-button
, create a "Click" trigger with the conditionClick ID equals submit-button
.Test your triggers.
Use Preview Mode to ensure your triggers fire as expected.
For more detailed instructions on common trigger configurations, see our step-by-step guide.
What is the dataLayer and Why Is It Important?
The dataLayer
is a JavaScript object that stores data about user interactions, making it accessible to GTM for tracking and tag triggering. For example, you can use the dataLayer
to capture information such as:
Page views or form submissions
Order ID, total value, and product details
Custom events like button clicks
How dataLayer Works in GTM:
Data Collection: The
dataLayer
stores information about user interactions on the website.Triggering Tags: GTM reads the data from the dataLayer and uses it to trigger tags based on conditions (e.g., firing a tag when a purchase is made).
Creating Variables: The
dataLayer
data can be stored in GTM variables (e.g., form IDs, user names, transaction values), which are then passed to analytics or advertising tools.
How to use the dataLayer
:
Here’s an example of a dataLayer.push()
used for tracking a form submission:
javascriptCopy codewindow.dataLayer = window.dataLayer || []; dataLayer.push({ 'event': 'formSubmission', 'formID': 'contactForm', 'userName': 'JohnDoe' });
GTM uses this data to trigger tags and populate variables, ensuring accurate and dynamic tracking. In this example:
An event named
formSubmission
is pushed to thedataLayer
, along with the form ID and user name.GTM can now use this event and data to trigger tags (such as tracking form completions).
Related Articles: