Google Tag Manager on WooCommerce is the recommended approach for managing GA4, Google Ads, Meta Pixel, and all other tracking without modifying theme code every time you need to add or change a tag. The GTM4WP plugin (the most widely used GTM integration for WordPress/WooCommerce) provides GTM installation plus a WooCommerce dataLayer integration that pushes all standard ecommerce events to the dataLayer for GTM to process.
Step 1: Create a GTM Container
Go to tagmanager.google.com. Create an account and a Web container for your WooCommerce store. GTM will generate a GTM ID in the format GTM-XXXXXXX. Keep this tab open — you need the GTM ID for the plugin setup.
Step 2: Install GTM4WP Plugin
In your WordPress admin, go to Plugins → Add New → search “GTM4WP”. Install and activate Google Tag Manager for WordPress by Thomas Geiger.
Go to Settings → Google Tag Manager. Enter your GTM ID (GTM-XXXXXXX). Under “Placement,” select Header (places the GTM snippet in the head tag) and also enable the Body noscript placement for compliance. Save the settings.
Step 3: Enable WooCommerce DataLayer Events
This is the step most guides miss. GTM4WP has native WooCommerce support, but it must be explicitly enabled.
In Settings → Google Tag Manager, scroll to the WooCommerce section. Enable:
- Track WooCommerce: enables all WooCommerce dataLayer events
- Use GA4 / UA schema: select GA4 to use the modern GA4 ecommerce schema
- Track product impressions, product views, add to cart, remove from cart: enable all these to get a complete funnel in GA4
Save settings. GTM4WP will now push the following events to window.dataLayer at the appropriate moments:
- woocommerce_view_item_list (product list pages)
- woocommerce_view_item (single product pages)
- woocommerce_add_to_cart
- woocommerce_remove_from_cart
- woocommerce_begin_checkout
- woocommerce_add_payment_info
- woocommerce_purchase (order confirmation page)
Step 4: Verify GTM Is Loading Correctly
Go to your GTM container and click Preview. Enter your WooCommerce store URL and click Connect. The Tag Assistant panel should appear alongside your store. Navigate to your homepage, a product page, and your cart. Confirm the GTM debug panel shows events firing.
In the Summary panel on the left, you should see page load events and any dataLayer pushes. On a product page, you should see a woocommerce_view_item event in the panel.
Step 5: Set Up Your First Tags
With GTM installed and the dataLayer populating, create tags for your tracking needs:
GA4 Configuration tag: fires on all pages, sends pageviews to GA4.
GA4 purchase event tag: fires on woocommerce_purchase event, sends purchase data to GA4.
Meta Pixel base code tag: fires on all pages.
Meta Pixel purchase event tag: fires on woocommerce_purchase event.
Step 6: GTM4WP Configuration for Checkout Pages
WooCommerce checkout pages (including the order confirmation /checkout/order-received/ page) are standard WordPress pages and load the GTM snippet normally via GTM4WP. Unlike Shopify’s separate checkout infrastructure, WooCommerce checkout pages use the same theme templates as the rest of your site, so GTM fires on them without any additional configuration.
This is one advantage WooCommerce has over Shopify for tracking implementation: there is no separate checkout infrastructure to work around.
Security Considerations for GTM on WordPress
GTM gives anyone with GTM access the ability to inject arbitrary JavaScript into your WooCommerce store. Limit GTM access to trusted team members only. Enable 2FA on all Google accounts with GTM access. Regularly audit your GTM container for unexpected tags or changes.
Book your free audit here and we will review your GTM setup on WooCommerce and confirm the dataLayer is populated correctly for all your tracking needs.