Google Tag Manager, aka GTM, is a great free tool by Google to deploy code snippets to websites and apps.
This includes tracking your website visitors, conversions, and social media pixels. Not just those, you can add many more types of codes.
Before GTM, all tracking codes needed to be hardcoded into your website. Now, you can add those codes in a matter of minutes without touching your website.
In this guide, we learn how to set up Google Tag Manager and then explore different ways of adding Google Tag Manager to your WordPress website.
There are tons of plugins that can add Google Tag Manager and other analytics code to WordPress websites. However, it is always recommended NOT to use plugins where possible, as they affect the website performance. The more plugins the heavier your WordPress website which means it will be slower.
Table of Content
How to setup Google Tag Manager?
To set up Google Tag Manager you will need a Gmail account. If you already have a Gmail account then follow the steps below otherwise create one. You can create as many Google Tag Manager accounts as you like for all your websites with one Gmail account.
You will be in Google Tag Manager where you will see an option to Create Account.
Click on Create Account button
Then you will two sections, the Account Setup and Container Setup
Under Account Setup enter your Account Name
Then choose your country as New Zealand
Under Container Setup enter the container name. Google suggests the website URL
Then under Target platform choose Web.
Then click Create
You will then be asked to Accept Google Tag Manager terms and conditions. Check the box and click Yes.
You will see a popup with code.
You have now setup Google Tag Manager account for your website. In the next steps we will install it.
There are multiple ways to install Google Tag Manager in WordPress. In this article, we will explore two methods.
Method 1, is where we use a plugin to install the code and method 2 will add the code to the WordPress theme. If the plugin is used for the sole purpose of adding Google Tag Manager then I would strongly recommend method 2. If you need to add multiple codes to your website then having a Code Manager plugin would help.
Method 1: Code Snippet plugin
This method shows how to install Google Tag Manager via the Code Snippet plugin only.