Tags, Triggers, & Variables
Tags, triggers, and variables are how we use GTM. With these we can install GA4, track phone call clicks, track form submissions, and send conversions to Google Ads and other ad platforms.
Tags and Triggers
A tag is a snippet of code that runs on a page. Most tags in Google Tag Manager send information from the site to another platform. Examples include the Google Tag, GA4 Event tags, and the Google Ads Conversion Tracking tag, which send information about activity on the site to Google.
Note: The Google Tag is not the same thing as Google Tag Manager. The Google Tag is the base code for GA4 and Google Ads. Google Tag Manager is the system we use to install and manage the Google Tag along with every other tag on the site.
Without a tag management system like Google Tag Manager, the code for each tag has to be added directly to the site’s source code. With Google Tag Manager, all of those tags are controlled from one web interface.
Tags typically fire when the page loads or in response to an interaction on the page. In Google Tag Manager, you attach triggers to tags to specify when they should fire. An example is the built-in “All Pages” trigger, which fires a tag on every page of the site as it loads.
Triggers and Variables
A trigger is a condition that evaluates to either true or false when the page runs. It does this by comparing the value in a variable to the value you set when you created the trigger.
A Tag Manager variable is a named placeholder whose value is filled in when the page runs. Tag Manager has many built-in variables, and you can create custom variables as well.
For example, the built-in variable Page URL always contains the URL of the page that’s currently loaded. If you want a tag to fire only on the page example.com/purchase/receipt.html, you would create a trigger that looks like this:
- Trigger Type: Page View
- This trigger fires on: Some Page Views
- Fire this trigger when an Event occurs and all of these conditions are true:
Page URL contains example.com/purchase/receipt.html
You can create variables to hold any piece of information you need when the page runs, then use them in trigger conditions or pass them to tags. For example, you might create a variable that holds the price of the item a user is viewing, or a constant variable that holds a client’s GA4 Measurement ID.