Technology

How to install and set up Google Tag Manager on WordPress

2025-03-10 10:29:46


If you have ever added code to track user behavior on your WordPress website, you may have heard of Google Tag Manager (GTM), which is a tool that allows you to easily add various tracking codes to your website.


However  Setting up GTM can be challenging for beginners since it requires manual code insertion. But don't worry, because in this article, we will guide you on how to properly install and configure Google Tag Manager on WordPress, including the easiest ways to track user behavior on your website.




What is Google Tag Manager?

Google Tag Manager (GTM) is a free tool from Google that allows you to add, update, and manage tracking codes (Tags) on your WordPress website all in one place.

Website owners often need to add multiple tracking codes, such as conversion tracking, form submissions, link clicks, and other analytical data collection. With GTM  You can manage everything from a single dashboard without having to edit the code yourself.



How to install Google Tag Manager on WordPress

1. Sign up for Google Tag Manager

  • Go to the Google Tag Manager website and click "Start for free."
  • Sign in to your Google account and click "Create Account."
  • Set an account name and select a country.
  • Add a container by selecting the platform as Web.
  • Accept the Google Tag Manager terms of service
  • Copy the GTM tracking code that appears.


2. Add the GTM code to the WordPress website

  • The easiest way: Use the WPCode plugin
  • Install and activate the WPCode plugin
  • Go to Code Snippets > Headers & Footers in the WordPress control panel.
  • Paste the copied code:
  • Place the <head> code in the Header section.
  • Place the <body> code in the Body field.
  • Click "Save Changes"



How to create a new tag in Google Tag Manager

  • Add Google Analytics 4 (GA4) through GTM
  • In Google Tag Manager, go to Tags >  เพิ่มแท็กใหม่
  • Name the tag and click Tag Configuration.
  • Select the tag type as Google Analytics: GA4 Configuration
  • Enter the Measurement ID, which can be found in Google Analytics (go to Admin > Data Streams).
  • Click Triggering and select Initialization - All Pages
  • Click Save and then Submit to apply the tag.



How to easily track user behavior with MonsterInsights

If you want to track advanced data without setting up GTM yourself, MonsterInsights is a plugin that allows you to easily install and use Google Analytics without having to edit any code.


Key features of MonsterInsights

  • Track link and button clicks – Display information on internal and external link clicks on the website.
  • Follow eCommerce – Help track sales, revenue, and top products.
  • Form submission tracking – No need to set up GTM tags yourself, the system will track it automatically.
  • Track scroll depth – Helps you know how far users have scrolled down the webpage.


How to install MonsterInsights

  • Install and activate the MonsterInsights plugin.
  • Click "Launch the Wizard" to set up Google Analytics automatically.
  • You can view the report from the WordPress dashboard without leaving the website.




Google Tag Manager is an effective tool for managing tracking codes on WordPress. If you want to install GTM yourself, you can use the WPCode plugin to easily add the code to your website. Alternatively, if you prefer a more convenient method, MonsterInsights will help you track user behavior without having to edit the code yourself.


I hope this article will help you easily install and set up Google Tag Manager on WordPress.

Leave a comment :