In this lesson, we’ll walk you through a complete and practical tutorial to connect Google Analytics 4 (GA4) to your WordPress website using Google Tag Manager (GTM). This setup allows you to collect pageviews and user data without manually editing code on your site — a must-have for marketers, data analysts, and eCommerce owners using platforms like WooCommerce.
Step 1: Create a Google Analytics 4 Account
- Go to analytics.google.com or search for “Create Google Analytics Account”
- Click Start Measuring to create an account or property
- Enter your account name, website name, time zone, and currency
- Choose business objectives (e.g., lead generation, sales)
- Click Create and accept the terms
Once setup is complete, copy your unique Measurement ID (starts with G-XXXXXXX) from the GA4 Web Stream settings.
Step 2: Open Google Tag Manager
- Login at tagmanager.google.com
- Select the container you previously created
Step 3: Create a GA4 Configuration Tag
- Go to Tags > New
- Choose Tag Type: Google Analytics: GA4 Configuration
- Paste your GA4 Measurement ID
- Set the Trigger to All Pages (this means the tag will fire on every page view)
- Click Save
Step 4: Preview and Test
- Click Preview in GTM
- Enter your WordPress website URL
- Make sure the GA4 tag fires correctly when pages load
- Use the Realtime report in GA4 to confirm data is received
Step 5: Publish and Document
Once tested, click Submit in GTM to publish your container.
Make sure to write a clear version name and description (e.g., “Added GA4 Pageview Tracking”).
This helps keep your tracking organized for you or future team members.
Why This Matters
Using GTM to manage your GA4 tags simplifies your analytics setup, allows for scalable tag deployment, and gives you the power to add future tracking (like eCommerce events or conversions) with zero code edits.