How to Set Up Google Tag Manager on Your WordPress Website (Step-by-Step)
If you’re looking to gain deeper insights into how users interact with your website, Google Tag Manager (GTM) is a must-have tool. It allows you to manage and deploy tracking tags without needing to touch your website’s code every time.
In this post, I’ll walk you through two simple methods to install GTM on your WordPress website manually using a code snippet, or using Google Site Kit.
What You’ll Need Before You Start
- A Google Tag Manager account
- Access to your WordPress admin dashboard
- (Optional) The Site Kit by Google plugin already installed
Method 1: Manual Installation Using WPCode
This approach gives you full control and is perfect if you already use a plugin like WPCode to insert code snippets into your site’s header or footer.
Step 1: Create a GTM Account
Head to Google Tag Manager, create a new account, and set up a container for your WordPress website.
Step 2: Copy the GTM Snippet
After creating your container, Google will show you two code blocks. Copy the first snippet (header section).
Step 3: Add Code to WordPress Header
In your WordPress dashboard:
- Go to Plugins > Add New
- Search for WPCode – Insert Headers and Footers
- Install and activate it
- Go to Code Snippets > Header & Footer
- Paste your GTM code into the Header section
- Save and enable the snippet
Step 4: Test the Connection
Back in GTM, click “Preview” and enter your website’s URL. If you see a green checkmark, you’re good to go!
Method 2: Using Google Site Kit (Recommended for Simplicity)
If you’re already using Site Kit to connect services like Google Analytics or Microsoft Clarity, this is the fastest method.
Step 1: Open Site Kit Settings
In WordPress, go to Site Kit > Settings
Step 2: Connect Tag Manager
Click “Connect More Services”, select Google Tag Manager, and follow the prompts to link your account and select your container.
Once connected, Site Kit automatically handles the code injection and keeps everything up to date.
Connecting GTM to Google Analytics (GA4)
After GTM is installed, don’t forget to connect it to Google Analytics 4 so you can start collecting meaningful data.
Here’s how:
- In Google Analytics, copy your GA4 Measurement ID
- In Google Tag Manager, go to Tags > New
- Choose “Google Tag” as your tag type
- Paste in your Measurement ID
- Set the trigger to All Pages
- Save and publish your container
This setup sends page views and auto-tracked events (like scrolls and session starts) to your GA4 dashboard. You can also add custom events (e.g. button clicks or form submissions) later via GTM.
Benefits of Tag Manager
Google Tag Manager gives you flexibility, control, and scalability over your tracking setup. Whether you choose to go the manual route or use the Site Kit plugin, you’re setting your site up for more advanced analytics capabilities.
If you’re already using GA4, Microsoft Clarity, or other tracking tools, GTM will serve as the central hub that simplifies how everything connects and works together.