Google Tag Manager has a ton of advantages for WordPress websites. It helps you add and handle all the assorted scripts you employ in your web site. For instance, as a substitute of needing to manually add code for providers like:
- Google Analytics
- Event monitoring
- Google Optimize
You can simply handle all the things by Google Tag Manager!
If you end up typically including numerous scripts to your WordPress web site, Google Tag Manager goes to be much more handy for you. And when you get the cling of it, you may even begin utilizing it to gather extra actionable knowledge to inform your advertising and marketing efforts.
In this submit, I’ll present you step-by-step how to set up Google Tag Manager in your WordPress web site, together with the place to add the code.
Let’s dive in!
- 1 Step 1: Sign Up For A Google Tag Manager Account
- 2 Step 2: Add Google Tag Manager Code Snippets To Your Site
- 3 Step 3: Test To Make Sure Your Snippets Are Working
- 4 Step 4: Create Your First Tag
- 5 Step 5: Publish Your Container
- 6 Resources To Help You Become A Google Tag Manager Pro
Step 1: Sign Up For A Google Tag Manager Account
If you haven’t already, the very first thing you want to do is join a free Google Tag Manager account.
You can do this by heading here.
Once you enroll, you ought to be within the Add a New Account interface. Give your organization a reputation:
Then, within the Setup Container part, enter your web site’s title within the Container title area 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 two code snippets. Keep this window open since you’ll want to add each of these code snippets to your WordPress web site within the subsequent part:
Step 2: Add Google Tag Manager Code Snippets To Your Site
This is the one half that’s type of difficult. Previously, you solely had to add one code snippet to your theme’s <head> part, however now Google Tag Manager needs you to add two snippets:
- The first one goes in your <head> part
- The second one goes proper after the opening <physique> tag
Beyond instantly enhancing your child theme, WordPress doesn’t offer you a straightforward method to insert code after the <physique> tag, and every theme works just a little in a different way so I can’t offer you a tutorial that applies to all themes.
- If you already really feel snug enhancing your little one theme’s recordsdata instantly, you may simply do this.
- If you don’t really feel snug working instantly together with your theme’s recordsdata, I’ll present you two totally different strategies that you should use – a beginner-friendly plugin and a simplified code technique.
To get began, set up and activate this free plugin. Then, go to Settings → Header and Footer in your WordPress dashboard to entry the plugin’s interface.
- Paste the first Google Tag Manager code snippet into the ON EVERY PAGE field within the <HEAD> PAGE SECTION INJECTION part
- Paste the second Google Tag Manager code snippet into the DESKTOP* field within the AFTER THE <BODY> TAG part (don’t fear – the code snippet will nonetheless load on mobile. Head, Footer, and Post Injections simply makes it attainable to use separate code snippets for those who examine the mobile field)
It ought to appear to be this:
Make certain to save your adjustments and also you’re all accomplished!
Option 2: Use A Functions.php Code Snippet
Let me lead by saying that this technique is technically not 100% optimum. It works high-quality for many websites, however I’ll clarify what I imply after I present you what to do.
To use it, all you want to do is add this code snippet to your little one theme’scapabilities.php file:
Make certain to substitute the placeholders with the precise code snippets.
So why isn’t this technique 100% optimum?
Because this technique places the second code snippet within the footer, somewhat than after the opening <physique> tag, your tag may not hearth if a customer doesn’t utterly load your web page (which is uncommon, however attainable). That’s the explanation Google recommends you add it as excessive up in your web site’s code as attainable.
But for many websites? This technique is completely high-quality.
Step 3: Test To Make Sure Your Snippets Are Working
To be sure to correctly put in Google Tag Manager:
- Go to the free GA Checker tool
- Enter your web site’s URL
- Click Check Your Site
Go to the Tag Manager tab of the outcomes and search for the inexperienced checkbox within the Tag Manager column:
If you see it – congrats! You correctly put in the Google Tag Manager scripts in your WordPress web site.
Step 4: Create Your First Tag
Once you’ve added the code snippets to your web site, you may return to the Google Tag Manager interface and create your first tag.
A “tag” is principally a particular script that you really want to insert into your web site with Google Tag Manager.
To get began, create a New Tag in your Google Tag Manager dashboard:
By clicking on Tag Configuration, you may select what kind of tag to create. Google consists of all types of pre-built choices for stuff like Google Analytics, Google Optimize, and plenty of third-party providers.
But it's also possible to use the Custom HTML or Custom Image tags to insert any client-side code:
Once you select your Tag Type, you’ll want to configure it following the settings.
Then, you may click on on the Triggering part to select when to “fire” your tag.
The default is All Pages, however it's also possible to get much more focused if you would like by clicking on the + icon:
Once you end setting issues up, click on Save.
Step 5: Publish Your Container
Now, all you want to do to make your tags stay is publish your Container.
To do 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 attainable to assist with model management in a while. That is, clarify precisely which tags you’ve added and what they do.
Then, click on PUBLISH:
And that’s it! You simply revealed your first tag.
How To Test If Individual Tags Are Firing
If you need to be sure the person tags in your container are firing, Google presents a free browser extension for Chrome known 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 the massive variety of interface choices goes past the scope of this submit.