Setting up Google Analytics in GTM
Getting started with GTM often begins with setting up Google Analytics. This will allow you to collect user data from your website and is necessary for the function of event tags. To set up Google Analytics in GTM, you will need to build one variable, one tag, and one trigger.
The Google Analytics Variable
Create a new variable, and select the variable type “Google Analytics Settings” – here you can paste your GA Property ID, which should look something like this: UA-000000-0. You also have the option to set your own Cookie Domain – however “auto” is the default configuration recommended for new implementations.
Opening the “More Settings” section enables you to set your Custom Dimensions and Custom Metrics, which can later be overwritten for each Analytics tag if necessary. Adding your Custom Dimensions and Custom Metrics to the variable means less time copying and pasting them throughout your event tags.
You can also toggle various options for Enhanced Ecommerce, Display Advertising, Enhanced Link Attribution and more.
The Google Analytics Tag
Create a new tag, and select the tag type “Google Analytics: Universal Analytics”. Choose the Track Type “Pageview”, then select your new variable from the dropdown labelled “Google Analytics settings”.
From the Advanced Settings section, select “Once Per Page” from the Tag firing options dropdown.
You can add your own Custom Dimensions from the Advanced Settings section if you have selected “Enable overriding settings in this tag”, otherwise leave this unticked.
The Google Analytics Trigger
Click on “Triggering” from your new tag to link your trigger to it. GTM comes with a few pre-set triggers, one of which is “All Pages” – this is used for the Google Analytics tag, but you will probably find yourself selecting it frequently!
With this Variable, tag, and trigger in place, you will start getting Pageview data in Google Analytics.