Where to put Google Tag Manager code in WordPress?

Google Tag Manager has become a popular tag management solution especially for small and medium business owners relying on WordPress CMS websites.  

In this guide, I will show you where to put the Google Tag Manager code in WordPress. This is really important because a large number of WordPress website owners are not good at modifying codes.

Google Tag Manager provides two codes to put on your website, one in the head section and the other in the body section.

 tag manager container scripts

Now follow the steps below to add Google Tag Manager code to your WordPress site.

Step1: Login to your WordPress admin and navigate to Appearance >> Editor.

 wordpress code editor

Step2: Look for the header.php file and open it.

 wordpress header file

Step3: Now paste the first tag manager container code just below the <head> tag as shown in the image below.

 tag manager code wordpress

Step4: paste the second container code just below the <body> tag.

 tag manager script code

Step5: Click on the update button and you’re done! 

Now you can verify the tag manager setup either by previewing the workspace changes or by using Google Tag Assistant chrome extension.  

If you are new to Tag Manager you can follow our step by step guide to install Google Tag Manager on wordpress. In this guide, I have covered everything you need to get started with Tag Manager.  

To read more guides and tips like this, follow us on Twitter.