Want to add Google Tag Manager to WordPress?
Google Tag Manager has a ton of advantages for WordPress websites. It helps you add and manage all the assorted scripts you utilize on your site. For instance, as a substitute of needing to manually add code for companies like:
- Google Analytics (aff)
- Event monitoring
- Google Optimize
You can simply manage the whole lot using Google Tag Manager!
If you end up usually including varied scripts to your WordPress site, Google Tag Manager is going to be a lot extra handy for you. And when you get the dangle of it, you'll be able to even start utilizing it to gather extra actionable information to tell your marketing efforts.
In this submit, I’ll present you step-by-step set-up Google Tag Manager on your WordPress site, together with the place to add the code.
Then, I’ll offer you fast information on how one can publish your first tag and ensure it’s working.
Let’s dive in!
Step 1: Sign Up For A Google Tag Manager Account
If you haven’t already, the very first thing you should do is join a free Google Tag Manager account.
You can try this by heading here.
Once you enroll, you need to be in the Add a New Account interface. Give your organization an identity:
Then, in the Setup Container part, enter your website’s identify in the Container identify discipline and select Web:
Once you settle for Google’s Terms of Service, Google ought to take you to the Google Tag Manager interface and present you with two code snippets. Keep this window open since you’ll want to add each of these code snippets to your WordPress site in the following part:
Step 2: Add Google Tag Manager Code Snippets To Your Site
This is the one half that’s a type of tough. Previously, you solely had to add one code snippet to the part of your theme, however now Google Tag Manager needs you to add two snippets:
- The first one goes in your part
- The second one goes proper after the opening tag
Beyond straight enhancing your little one theme, WordPress doesn’t offer you a straightforward strategy to insert code after the tag, and every theme works a little in another way so I can’t offer you a tutorial that applies to all themes.
- If you already really feel comfy enhancing your little one theme’s recordsdata straight, you'll be able to simply try this.
- If you don’t really feel comfy working straight along with your theme’s recordsdata, I’ll present you two completely different strategies that you should use – a beginner-friendly plugin and a simplified code technique.
Option 1: Use Head, Footer, and Post Injections
If you’re happy with dedicating a plugin to Google Tag Manager, the best approach to add it is utilizing the free Head, Footer, and Post Injections plugin.
To get began, set up and activate this free plugin. Then, go to Settings → Header and Footer in your WordPress dashboard to enter the plugin’s interface.
- Paste the first Google Tag Manager code snippet into the ON EVERY PAGE field in the PAGE SECTION INJECTION part
- Paste the second Google Tag Manager code snippet into the DESKTOP* field in the AFTER THETAGpart (don’t fear – the code snippet will nonetheless load on cell. Head, Footer, and Post Injections simply makes it potential to make use of separate code snippets if you happen to test the cell field)
It ought to seem like this:
Make certain to avoid wasting your adjustments and also you’re all carried out!
Option 2: Use A Functions.php Code Snippet
Let me lead by saying that this technique is technically not 100% optimum. It works effectively for many websites, however, I’ll clarify what I imply after I present to you what to do.
To use it, all you should do is add this code snippet to your little one theme’s functions.php file:
Make certain to interchange the placeholders with the precise code snippets.
So why isn’t this technique 100% optimum?
Because this technique places the second code snippet in the footer, somewhat then after the opening tag, your tag would possibly not fireplace if a customer doesn’t fully load your page (which is uncommon, however potential). That’s the reason Google recommends you add it as high up in your site’s code as potential.
But for many websites? This technique is completely effective.
Step 3: Test To Make Sure Your Snippets Are Working
To ensure you correctly put in Google Tag Manager:
- Go to the free GA Checker tool
- Enter your website’s URL
- Click Check Your Site
Go to the Tag Manager tab of the outcomes and search for the inexperienced checkbox in the Tag Manager column:
If you see it – congrats! You correctly put in the Google Tag Manager scripts on your WordPress site.
Now, I’ll shortly undergo use Google Tag Manager to create your first tag.
Step 4: Create Your First Tag
Once you’ve added the code snippets to your site, you'll be able to return to the Google Tag Manager interface and create your first tag.
A “tag” is mainly a particular script that you simply need to insert into your site with Google Tag Manager.
To get began, create a New Tag in your Google Tag Manager dashboard:
By clicking on Tag Configuration, you'll be able to select what sort of tag to create. Google contains all types of pre-built choices for stuff like Google Analytics (aff), Google Optimize, and plenty of third-party companies.
But you may as well use the Custom HTML or Custom Image tags to insert any client-side code:
Once you select your Tag Type, you’ll configure it following the settings.
Then, you'll be able to click on the Triggering part to decide on when to “fire” your tag.
The default is All Pages, however, you may as well get a lot of extra focus for you by clicking on the + icon:
Once you end setting issues up, click on Save.
Step 5: Publish Your Container
Now, all you should do to make your tags reside is publish your Container.
To try this, click on on the SUBMIT button in your Google Tag Manager interface:
Then, enter a Version Name and Version Description. I like to recommend that you simply make these as detailed as potential to assist with model management later on. That is, clarify precisely which tags you’ve added and what they do.
Then, click on PUBLISH:
And that’s it! You simply printed your first tag.
How To Test If Individual Tags Are Firing
If you need to be sure that the person tags in your container are firing, Google gives a free browser extension for Chrome referred to as Tag Assistant.
Resources To Help You Become A Google Tag Manager Pro
At this level, you’ve efficiently added Google Tag Manager to WordPress. But Google Tag Manager is fairly deep in performance and explaining a large number of interface choices goes past the scope of this submit.
So – now that you've Google Tag Manager put in, you'll be able to study a complete lot extra in regards to the interface in this Moz article.
And for extra associated reading on some of the tags you'll be able to implement in Google Tag Manager, take a look at our posts on Google Analytics (aff) and WooCommerce Google Analytics objectives.