Google Tag Manager (GTM) is a powerful, free tool that enables marketers, analysts, and developers to manage and deploy marketing tags (snippets of code) on a website without modifying the site code directly.
In this lesson, we’ll walk through how to properly install Google Tag Manager on a WordPress WooCommerce website, and make sure it’s ready for tracking events and sending data to Google Analytics 4 (GA4) and other tools.
Why Use Google Tag Manager on Your WooCommerce Store?
If you’re running an eCommerce store, data is everything. GTM gives you a flexible and scalable way to track events like product views, add-to-carts, purchases, scrolls, and much more—all without touching your website code every time you want to track something new.
By integrating GTM with your WooCommerce website, you unlock full control over your tracking setup while ensuring your site performance and SEO aren’t negatively impacted.
Step-by-Step: Installing Google Tag Manager on WordPress (WooCommerce)
Let’s go through the practical steps taken in this lesson to connect GTM to your WooCommerce store.
1. Create a GTM Account
- Go to https://tagmanager.google.com
- Click “Create Account”
- Enter your account name (e.g., your brand or business name)
- Add your Container name (usually your website URL)
- Choose Web as the target platform
- Click Create and agree to the terms
Once you’ve created your container, Google Tag Manager will give you two code snippets:
one for the <head> of your site and one for the <body> section.
2. Add GTM Code to WordPress Using WPCode Plugin
To avoid editing your theme files manually, we recommend using the WPCode plugin.
- In your WordPress dashboard, go to Plugins > Add New
- Search for WPCode – Insert Headers and Footers
- Install and activate the plugin
- Navigate to Code Snippets > Header & Footer
- Paste the first GTM code in the Header section
- Paste the second GTM code in the Body section
- Save the changes
3. Verify Installation with GTM Preview Mode
- Go back to GTM and click Preview
- Enter your website URL and click Connect
- Your site will open with a debug panel if GTM is correctly installed
Best Practices & Tips
- Always test your tags in Preview mode before publishing
- Keep your GTM container organized using folders and clear naming
- Use GA4 tags to track user interactions like purchases or scrolls
- Leverage custom events and dataLayer pushes for WooCommerce tracking