For those not familiar with Google Tag Manager, here is how it works.
- Add a Google Tag Container to your website, (similar to how you add google analytics tracking code).
- Then add tracking code and tags to the tag container from the Tag Manager website.
- The tracking code and tags are then added to your website and you do not need to adjust any HTML, PHP or WordPress plugins on your site again. All tracking updates are done through the Tag Manager Website.
This system makes managing tags and tracking codes so much easier and more enjoyable. Once you get the hang of working with GTM, you will be much more likely to update and improve your tracking code.
This guide will walk you through the different methods for Adding Google Tags to your WordPress site. I have also included when it is the best use the methods and when to avoid using them.
Essentially you have three main options for adding the tag container to WP.
- Use a WordPress Plugin
- Use admin interface in WordPress template
- Use a text editor to add code directly to WordPress code
Google Tag Manager WordPress Plugins
This is probably the easiest way to add the tag container to your website. Generally you just install and activate the plugin, then go to the plugin settings page and add the container tracking id. then you are done. That is it.
The downside is you are adding one more plugin to your site, the code may not get placed exactly where you need it to, without modifying any theme files.
This method is good for:
- Those who are not super familiar with WordPress and working with raw code.
- Those who manage lots of sites with lots of different templates, it allows you to standardize on how the GTM code is added.
- Sites that get turned over to end users who want things as simple as possible.
This method is not good for:
- Those who want to keep the number of installed plugins to a minimum
- Those who want the code placed in the exact spots as google specifies
- Those who are familiar with WordPress, how it works and HTML/PHP files.
Google Tag Manager for WP by DuracellTomi
- Main Website: https://gtm4wp.com/
- WP.org Plugin Page: https://wordpress.org/plugins/duracelltomi-google-tag-manager/
- WP.org Support Page: https://wordpress.org/support/plugin/duracelltomi-google-tag-manager
This may be the most popular and best to use WordPress plugin.
Template Admin to add Google Tag Manager Code
This is a great way to add GTM to your site if your template has the built-in features available. Not all templates will have this ability and the process will vary from template to template.
Advantages include: not needing a WP plugin to accomplish the task. Better control of where exactly the code will be placed in the template. Additionally, you do not have to go into the raw HTML to insert code.
Disadvantages include: process varies from template to template so, not a one size fits all process. Need some coding and WordPress knowledge to complete the task. Not a ton of knowledge but a little familiarity.
This method is good for:
- Those who want to keep installed plugins to a minimum
- Those who are familiar with WordPress and HTML/PHP coding
- Those who build a lot of sites and have standardized on a single template
This method is not good for:
- Those who do not like working with raw code
- Those who will turn sites over to end users who want to make technical updates
- Those who work with lots of different templates or on a team of developers who do lots of sites and each developer wants to do his own thing.
BeTheme
If you are using BeTheme, then you can skip adding a plugin by following these steps. The advantage to this is you have one less plugin installed on your site.
When adding Google tag manager there are two parts.
One snippet goes in the head
One snippet goes in the body
When using Betheme here is where to add both parts
Part that goes in the head is pasted into
Betheme > SEO > Google Analytics
Part that goes into the body goes
BeTheme > Global > Hooks > Top
<!– Google Tag Manager (noscript) –>
<noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX”
height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
<!– End Google Tag Manager (nosc
Add Google Tag Manager directly to template code
This is probably the most technically advanced method and if you know what you are doing probably the easiest. The drawback, it will take another technical person to follow what you did.
Advantages: This works great if you are on a team of experts all working on high-level sites, this is a good way to go. It is clean easy and straight to the point. No plugins to install, you are directly editing the code and no extra overhead, that could slow down your page load times.
Disadvantages: You need to know exactly what you are doing. If other non-technical people are going to come behind you, they will not know what you have done and could break the site trying to fix it.
This method is good for:
Fullon WordPress developers who know what they are doing
When you only have one cook in the kitchen
This method is not good for
Those who are not technical
Sites that could get passed on to end users or nondevelopers.
Additional Resources
Great Post about creating a GTM account and getting started with Google tag manager: https://www.lunametrics.com/blog/2017/01/26/install-google-tag-manager-on-wordpress/

Steven Johnson, a WP Hosting Reviews senior editor, works from Atlanta and covers all things related to WordPress and Hosting.
He graduated from Georgia Tech in Chemical Engineering, has managed hosting companies and now builds WordPress and Joomla Websites for small to medium companies full time.