How To Add Google Tag Manager To WordPress And Create Your First Tag

Need so to add google Designate Supervisor to wordpress?

google Designate Supervisor has a ton of advantages for wordpress sites. It helps you add and take care of your total a huge amount of scripts you make use of on your order. Shall we tell, as yet one more of needing to manually add code for companies and products savor:

You would gorgeous take care of the total lot thru google Designate Supervisor!

Within the occasion you wreck up progressively including diverse scripts to your wordpress order, google Designate Supervisor is going to be loads more convenient for you. And once you rep the dangle of it, that you just’ll want to presumably even originate the use of it to rep more actionable knowledge to expose your marketing and marketing efforts.

On this put up, I’ll prove you step-by-step the obedient map to set up google Designate Supervisor on your wordpress order, including where so to add the code.

Then, I’ll give you a fleet recordsdata for the technique that you just’ll want to presumably post your first keep and clarify that it’s working.

Let’s dive in!

Step 1: Imprint Up For A google Designate Supervisor Story

Within the occasion you haven’t already, the first ingredient you would prefer to pick out up is register for a free google Designate Supervisor narrative.

You would pick up that by heading here.

Whereas you register, you desires to be in the Add a Unique Story interface. Give your firm a repute:

sign up for gtm

Then, in the Setup Container half, enter your web pages’s name in the Container name discipline and plot shut Web:

configuire container

Whereas you pick up google’s Phrases of Service, google must desire you to the google Designate Supervisor interface and prove you two code snippets. Retract this window open which implies that of you’ll have to add both of these code snippets to your wordpress order in the next half:

google tag manager code snippets

Step 2: Add google Designate Supervisor Code Snippets To Your Do

Here’s the one half that’s form of tricky. Beforehand, you handiest had so to add one code snippet to your theme’s half, however now google Designate Supervisor wants you so to add two snippets:

  • The first one goes to your half
  • The 2d one goes appropriate after the outlet keep

Beyond straight editing your child theme, wordpress doesn’t give you an easy technique to insert code after the keep, and every theme works a slight differently so I will be succesful to’t give you an educational that applies to all themes.


  • Within the occasion you already if truth be told feel joyful editing your child theme’s recordsdata straight, that you just’ll want to presumably gorgeous pick up that.
  • Within the occasion you don’t if truth be told feel joyful working straight with your theme’s recordsdata, I’ll prove you two varied suggestions that that you just’ll want to presumably use – a newbie-good plugin and a simplified code technique.

Option 1: Utilize Head, Footer and Post Injections

Within the occasion you’re okay with dedicating a plugin to google Designate Supervisor, doubtlessly the most inspiring map so to add it’s a long way the use of the free Head, Footer and Post Injections plugin.

To originate, set up and activate this free plugin. Then, trot to Settings → Header and Footer to your wordpress dashboard to rep admission to the plugin’s interface.


  • Paste the first google Designate Supervisor code snippet into the ON EVERY PAGE box in the PAGE SECTION INJECTION half
  • Paste the 2d google Designate Supervisor code snippet into the DESKTOP* box in the AFTER THE TAG half (don’t grief – the code snippet will still load on mobile. Head, Footer, and Post Injections gorgeous makes it doubtless to use separate code snippets whenever you happen to study the mobile box)

It is going to witness savor this:

how to add google tag manager to wordpress - where to put code

Be sure to assign your adjustments and likewise you’re all executed!

Option 2: Utilize A Capabilities.php Code Snippet

Let me lead by asserting that this system is technically no longer 100% optimum. It works lovely for most sites, however I’ll indicate what I mean after I prove you what to pick out up.

To make use of it, all you would prefer to pick out up is add this code snippet to your child theme’ssuggestions.php file:

add_action('wp_head', 'gtm_head_code');
Characteristic gtm_head_code(){
add_action('wp_footer', 'gtm_body_code');
Function gtm_body_code(){

Be sure to replace the placeholders with the exact code snippets.

So why isn’t this system 100% optimum?

Because this system puts the 2d code snippet in the footer, in assign of after the outlet keep, your keep could well no longer fire if a visitor doesn’t fully load your page (which is fresh, however doubtless). That’s the motive google recommends you add it as high as a lot as your order’s code as doubtless.

However for most sites? This technique is entirely lovely.

Step 3: Test To Form Certain Your Snippets Are Working

To clarify that you just correctly assign aside in google Designate Supervisor:

  • Hotfoot to the free GA Checker machine
  • Enter your web pages’s URL
  • Click Check Your Do

Hotfoot to the Designate Supervisor tab of the outcomes and witness for the inexperienced checkbox in the Designate Supervisor column:

test tag manager

Within the occasion you gaze it – congrats! You correctly assign aside in the google Designate Supervisor scripts on your wordpress order.

Now, I’ll like a flash struggle thru the obedient map to use google Designate Supervisor to execute your first keep.

Step 4: Originate Your First Designate

Whereas you’ve added the code snippets to your order, that you just’ll want to presumably return to the google Designate Supervisor interface and execute your first keep.

A “keep” is de facto a selected script that that you just’ll want to also very correctly be concerned to insert into your order with google Designate Supervisor.

To originate, execute a Unique Designate to your google Designate Supervisor dashboard:

create tag

By clicking on Designate Configuration, that you just’ll want to presumably plot shut what form of keep to execute. google entails every form of pre-constructed alternate suggestions for stuff savor google Analytics, google Optimize, and hundreds third-celebration companies and products.

However that you just’ll want to also use the Personalized HTML or Personalized Image tags to insert any client-side code:

choose tag type

Whereas you in deciding your Designate Form, you’ll have to configure it following the settings.

Then, that you just’ll want to presumably click on on the Triggering half to plot shut when to “fire” your keep.

The default is All pages, however that you just’ll want to also rep loads more centered in expose for you by clicking on the icon:


Whereas you enact atmosphere things up, click on Build.

Step 5: Submit Your Container

Now, all you would prefer to pick out as a lot as make your tags live is post your Container.

To attain that, click on on the SUBMIT button to your google Designate Supervisor interface:


Then, enter a Model Name and Model Description. I like to recommend that you just make these as detailed as doubtless to support with model support a watch on later on. That is, indicate exactly which tags you’ve added and what they pick up.

Then, click on PUBLISH:

publish container

And that’s it! You gorgeous revealed your first keep.

How To Test If Individual Tags Are Firing

Within the occasion you’d savor to clarify that the particular person tags to your container are firing, google presents a free browser extension for Chrome called Designate Assistant.

Resources To Support You Become A google Designate Supervisor Pro

At this point, you’ve successfully added google Designate Supervisor to wordpress. However google Designate Supervisor is somewhat deep in functionality and explaining the astronomical amount of interface alternate suggestions goes beyond the scope of this put up.

So – now that that you just’ll want to pick out up google Designate Supervisor assign aside in, that you just’ll want to presumably be taught a full lot more referring to the interface in this Moz article.

And for more associated studying on about a of the tags that you just’ll want to presumably enforce in google Designate Supervisor, strive our posts on google Analytics and WooCommerce google Analytics dreams.