When you take your website serious, you want to track the usage of your site. With the statistics you collect you measure how successful your website is. For example you want to measure, how often your website is visited, how often your contact form is submitted or how many orders you get from you webshop. All of these statistics you can measure with Google Analytics. When you want to also track statistics for Google Adwords & Facebook you can use the Google Tag Manager. With Google Tag Manager you can manage Tags, Triggers & Variables which give you the possibilities to measure lots of things.
What you need for Google Tag Manager and WordPress
To get started setting up Tag Manager with WordPress you need the following:
- Google Tag Manager account
- WordPress website
- DuracellTomi’s Google Tag Manager plugin for WordPress
Setup your Google Tag Manager account
I assume that you already did register for Google Tag Manager. When you first time use the tag manager you get a page to ‘Create account’. The structure Google Tag Manager uses two levels:
- Accounts: Holds all containers;
- Containers: To use for different purposes.
Setup your account and container
- Give a name to your account. For example the name of the company you setup the account for and click ‘Continue’;
- Give your container a name. For example the domainname of the website you will use it for. Also make the choice ‘Web’, ‘iOS’, ‘Android’ or ‘AMP’ and click ‘Create’.
- After accepting the ‘Service Agreement’ you get the codes you need to integrate in your website. For now you can leave this as it is;
- You now see the ‘Dashboard’ of the created container.
Within the container of Google Tag Manager you see a couple of items we can use. A difference is being made between:
- Tags: A tag is a piece of code that sends information to a third party like Google Analytics, Adwords of other;
- Triggers: A trigger is a condition that evaluates to either true or false at runtime. When a trigger is attached to a tag is determines when the tag will run or not;
- Variables: Variables are name-value pairs for which the value is populated during runtime. For example, the predefined variable named “url” has been defined such that its value is the current page URL.
- Folders: When you use the tag manager intensively the number of items can grow and grow. To keep organized you can add every item to a folder.
Connect your Google Tag Manager to WordPress
The next step is to connect the tag manager to your WordPress website. We will to this with the WordPress plugin ‘DuracellTomi’s Google Tag Manager for WordPress‘. This plugin makes it easy to install the tag manager and gives you multiple options for example WooCommerce and video tracking. Install and activate the plugin with the ‘WordPress installer’.
The last step to connect Google Tag Manager is to setup your GTM-ID within your WordPress website. Deze ID is de Container ID within GTM. The easiest way to find the ID is in the top-right corner in the dashboard or on the accounts page with all containers you have created. Every account has an unique ID like: GTM-XXXXXXX. Copy this ID and paste it in the field on the settings page. To finalise the connection you need to select the way you want to place the containercode.
My advise would be to choose the ‘Codeless injection’ because you don’t have to add the code in your WordPress theme and the code is placed on the right place.
Congratulations! You now have connected Google Tag Manager with your WordPress website.