Google Tag Manager is a tag management system created by Google. It makes adding tracking scripts to your website easy, without the need for adding scripts directly into the code. Google Tag Manager provides a more efficient way to deploy your Google Analytics tracking, including enabling tracking opportunities that are harder to implement using Google Analytics alone.
Tag manager components
There are a few key components to understand before getting started with Google Tag Manager. These are Tags, Triggers and Variables, which lie at the core of Google Tag Manager.
- Tags – Code snippets that are used for analytics, marketing and support purposes.
- Triggers – Cause tags to ‘fire’, or activate, when a specific event happens. These events can be anything from form submissions to button clicks, and so much more.
- Variables – Placeholders that are dynamically populated with data.
You will be adding a Google Analytics tag that’s triggered on all pages and uses your Google Analytics tracking ID as a variable.
To get Google Tag Manager you will need to create an account which you can do here: https://tagmanager.google.com/.
- In Google Tag Manager, click Accounts and then Create account.
- Enter an account name and optionally indicate whether you’d like to share data anonymously with Google and others.
- Click Continue.
- Enter a descriptive container name and select the type of content: Web.
- Click Create.
- Review the Terms of Service and click Yes if you agree to those terms.
When your new container first loads, you will be prompted with the web container installation code snippet.
Install the container
The next step is to install your Google Tag Manager container. To do this you will need to edit the <head> of your website templates.
- Place the <script> code snippet in the <head> of your web page’s HTML output, preferably as close to the opening <head> tag as possible.
- Place the <noscript> code snippet immediately after the <body> tag in your HTML output.
Add and publish tags
The container is now ins, you’re ready to add your Google Analytics tracking tag.
1) To add a tag click Tags from the navigation menu, then click New.
2) Click anywhere in the Tag Configuration section to get started with adding a new tag
3) Select the Google Analytics: Universal Analytics tag type and under Google Analytics Settings click New Variable…
4) Add your Google Analytics tracking code UA-108079571-1 into the Tracking ID field and click Save
5) You should now be back at the Tag Configuration window. At the bottom of this window you will find the Tag Triggering section. Click anywhere in this section to set up a trigger
6) Select the All Pages trigger and click Save
7) Preview mode gives you an opportunity to inspect your Tag Manager configuration on your site to make sure everything behaves as expected. You can use the debug option to see which tags fire as you browse and interact with the site.
8) When you’re ready, click Submit in the upper-right corner of the screen to begin publishing your changes. From here you’ll be able to add container details and Publish your changes.
Google Analytics will now start firing on every page, collecting information about the traffic on your website. It’s also worth setting up additional tracking on conversion points, such as your contact form. See this article for more information on how to implement contact form tracking on your website.