Most WooCommerce tracking setups fail at the data layer. The conversion tag fires, but it fires with no transaction ID, no revenue, no items. Google Ads records a conversion, but it is unattributed and unvalued. Smart Bidding is optimizing on noise.
The root cause is usually the same: tracking is bolted on after the fact via a Google Ads tag that reads a static value, rather than being driven by a proper ecommerce data layer push from the server.
GTM4WP by Thomas Geiger solves this cleanly. It is a free WordPress plugin (13.9M+ downloads) that places the GTM container on your site and pushes a full GA4-compliant ecommerce data layer from WooCommerce into GTM automatically, including purchase events, product data, transaction IDs, and revenue figures — without touching your theme code.
This post covers the full setup: installing and configuring GTM4WP, understanding what data layer events it generates, building the GTM tags for Google Ads conversion tracking, and verifying everything works.
What GTM4WP Does (and Does Not Do)
GTM4WP places your GTM container snippet on all pages of your WordPress site and enriches the data layer with page metadata, user data, and WooCommerce ecommerce events.
For WooCommerce specifically, it pushes:
purchaseevent on the order received (thank-you) page, with full transaction data and item arrayadd_to_cartevent when a product is added to the cartselect_itemevent when a product is clicked from a listing page
The events follow the GA4 ecommerce spec, which means they include an ecommerce object with the fields GTM variables can read directly.
What it does not handle: promotions tracking, refunds, and it has known compatibility issues with Elementor Pro when it overrides the default WooCommerce order-received template. If your thank-you page is built with Elementor Pro, the purchase event may not fire — more on this later.
Step 1: Install and Configure GTM4WP
In your WordPress admin: Plugins > Add New > search “GTM4WP” — the plugin is listed as “GTM4WP - Google Tag Manager Plugin for WordPress” by Thomas Geiger.
Install and activate it.
Go to Settings > Google Tag Manager to configure.
General Tab
Container ID: Enter your GTM container ID (format: GTM-XXXXXXX). This is the only required field to get the container on the site.
Container code placement: Set to “Header (recommended).” This places the <script> tag in the <head> and the <noscript> fallback immediately after the opening <body> tag, which is the correct GTM implementation.
Enable GTM for logged in users: Decide whether to track WordPress admins and editors. For most setups, disable tracking for admins to keep conversion data clean. GTM4WP has a “User roles to exclude from tracking” option — add Administrator at minimum.
Events Tab
This controls which additional data layer events the plugin pushes beyond the basic page data.
Leave most of these at their defaults for now. The WooCommerce-specific settings are in the next tab.
Integrate Tab
Scroll to the WooCommerce section.
Enable: Toggle on “Track WooCommerce store activity.”
Ecommerce events: You will see options for which events to track. Enable:
- Purchase (fires on order-received page)
- Add to cart
- Product detail views (fires the
view_itemevent) - Product list views (fires
view_item_list)
For Google Ads conversion tracking, the purchase event is the critical one. The others are useful for GA4 analytics and remarketing audiences but are not required for conversion attribution.
Use SKU as item ID: If your WooCommerce products have SKUs, enable this. If not, it falls back to the product’s numeric post ID. Using SKU is generally preferable for matching against product feeds in Google Merchant Center.
Save your settings.
Step 2: Verify the Data Layer Push
Before building any GTM tags, verify that GTM4WP is correctly pushing the purchase event.
Method: Place a test order on your WooCommerce store (use a payment gateway in test mode, or use the “Cash on Delivery” option for a real but unpaid order). After the order completes, you should land on a URL like yoursite.com/checkout/order-received/12345/.
On that page, open browser DevTools (F12) and run in the console:
dataLayer.filter(function(e) { return e.event === 'purchase'; })
You should see an array with one object. It should look something like this:
[{
event: 'purchase',
ecommerce: {
transaction_id: '12345',
value: 89.99,
tax: 7.20,
shipping: 5.00,
currency: 'USD',
items: [
{
item_id: 'TSHIRT-BLK-M',
item_name: 'Black T-Shirt',
item_category: 'Clothing',
price: 89.99,
quantity: 1
}
]
}
}]
If this array is empty or the command returns [], the purchase event is not being pushed. Common causes:
- The order-received page is using a custom template (Elementor Pro, custom theme)
- WooCommerce tracking was not enabled in GTM4WP’s Integrate tab
- The page is cached and the data layer push is not running server-side
If the object is there but ecommerce is null or missing fields, check the GTM4WP WooCommerce settings to confirm the event types are enabled.
Step 3: Set Up GTM Variables to Read the Data Layer
In GTM, create Data Layer Variables to extract the ecommerce values you need for your Google Ads conversion tag.
Go to Variables > New > Variable Type: Data Layer Variable.
Transaction ID variable:
- Name:
DL - transaction_id - Data Layer Variable Name:
ecommerce.transaction_id - Data Layer Version: Version 2
Conversion Value variable:
- Name:
DL - ecommerce value - Data Layer Variable Name:
ecommerce.value - Data Layer Version: Version 2
Currency variable:
- Name:
DL - currency - Data Layer Variable Name:
ecommerce.currency - Data Layer Version: Version 2
Save all three variables.
To verify they are reading correctly: enable GTM Preview mode, place a test order, and navigate to the order-received page. In the Preview panel, find the purchase event and click Variables. You should see DL - transaction_id, DL - ecommerce value, and DL - currency populated with the correct values from the order.
Step 4: Create the Conversion Linker Tag
Before building any conversion tag, ensure the Conversion Linker is in your container and configured correctly.
If it is not already there:
- Tags > New > Tag Type: Conversion Linker
- Trigger: All Pages
- Name:
Conversion Linker - All Pages - Save
The Conversion Linker reads the GCLID from the URL on arrival and stores it in a first-party cookie (_gcl_aw). The Google Ads conversion tag reads from this cookie. If the Conversion Linker does not fire on the landing page, the GCLID is never stored and conversions are unattributed.
Set the Conversion Linker’s firing priority to 50 (Advanced Settings > Priority) so it consistently fires before conversion tags on the same trigger.
Step 5: Create the Google Ads Purchase Conversion Tag
In Google Ads, you need an existing conversion action for purchases. If you do not have one:
- Go to Goals > Conversions > New conversion action
- Select “Website”
- Category: Purchase
- Name it (e.g., “WooCommerce Purchase”)
- Value: Use a different value for each conversion (this is what lets you use dynamic revenue)
- Count: One (count one conversion per order)
- Save and note the Conversion ID and Conversion Label from the tag setup screen
Back in GTM:
- Tags > New > Tag Type: Google Ads Conversion Tracking
- Conversion ID: from your Google Ads conversion action
- Conversion Label: from your Google Ads conversion action
- Conversion Value:
{{DL - ecommerce value}} - Transaction ID:
{{DL - transaction_id}} - Currency Code:
{{DL - currency}} - Trigger: Custom Event, Event Name:
purchase
Name the tag Google Ads - Purchase Conversion - WooCommerce.
Under Advanced Settings > Tag Sequencing, set the Setup Tag to your Conversion Linker tag. This ensures the GCLID is always stored before the conversion tag fires.
Save the tag.
Step 6: Add Deduplication Logic
WooCommerce’s order-received page can be reached multiple times — a customer refreshes the page, navigates back via browser history, or shares the URL. Without deduplication, each visit fires another conversion.
The Transaction ID field in the Google Ads conversion tag handles this on Google’s side: Google Ads will not count two conversions with the same transaction ID within the conversion window. The {{DL - transaction_id}} variable you set in Step 5 is the deduplication key — always keep it populated.
For additional safety, prevent the GTM tag from firing more than once per session by adding a session storage check in a Custom JS Variable:
function() {
var orderId = {{DL - transaction_id}};
if (!orderId) return false;
var key = 'conversion_fired_' + orderId;
try {
if (sessionStorage.getItem(key)) return false;
sessionStorage.setItem(key, '1');
return true;
} catch(e) {
return true; // if sessionStorage fails, allow the tag to fire
}
}
Name this variable JS - conversion not yet fired. Add it as a trigger exception on your Google Ads purchase conversion tag: fire only when JS - conversion not yet fired equals true.
Combined with the transaction ID deduplication in Google Ads, this prevents both same-session duplicates (sessionStorage check) and cross-session duplicates (Google Ads deduplication by transaction ID).
Step 7: Verify End-to-End in GTM Preview
- Enable GTM Preview mode.
- In a new tab, simulate a Google Ads click by appending
?gclid=test_gclidto your homepage URL (e.g.,https://yoursite.com/?gclid=test_gclid). - Browse the site and complete a test purchase.
- On the order-received page, open the GTM Preview panel.
- In the event list, find
purchase. - Check Tags:
Google Ads - Purchase Conversion - WooCommerceshould appear under Fired Tags. - Check Variables:
DL - transaction_id,DL - ecommerce value, andDL - currencyshould have correct values. - In DevTools > Application > Cookies, confirm
_gcl_awexists (set by the Conversion Linker on the landing page).
If the conversion tag did not fire, check:
- Is the
purchaseevent appearing in the Preview event list? If not, the data layer push from GTM4WP is not working. - If the
purchaseevent is there but the tag did not fire, check the trigger — confirm the Custom Event trigger matches the exact event namepurchase.
Common Issues with GTM4WP and WooCommerce
Purchase Event Not Firing with Elementor Pro
Elementor Pro’s WooCommerce builder replaces the default order-received template with its own. GTM4WP’s purchase event push is hooked into the default WooCommerce template. When Elementor Pro overrides it, the hook does not run and the event is never pushed.
Fix: In Elementor, do not use the custom thank-you page template for the order-received page. Use the default WooCommerce template for that page specifically. Alternatively, ask your developer to add the GTM4WP data layer push to the custom template manually.
Double Firing on Cached Pages
If your site uses a full-page caching plugin (WP Rocket, W3 Total Cache), the order-received page might be cached after the first visit. Subsequent visits serve the cached page, which may replay the data layer push.
Fix: Exclude the order-received URL pattern from page caching. In WP Rocket: Settings > Cache > Never Cache the Following Pages, add /checkout/order-received/. Most caching plugins have an equivalent exclusion setting.
Revenue Value Is Zero or Missing
GTM4WP pulls the order value from WooCommerce’s order object server-side. If the value comes through as 0, check whether your WooCommerce currency settings match what the data layer reports. Also verify whether you want value to include or exclude tax and shipping — configure this in GTM4WP’s WooCommerce settings under “Track order values including taxes” and “Track order values including shipping.”
GTM Container Not Loading
If GTM4WP is installed but the container snippet is not appearing on the site, check:
- The Container ID is entered correctly in GTM4WP settings (format
GTM-XXXXXXX) - Your theme’s
header.phpcallswp_head()— themes that do not call this hook will not output GTM4WP’s script tag - A security plugin (Wordfence, iThemes) is not blocking the script injection
What to Track Next
With purchase conversion tracking in place, the logical next additions are:
Add to Cart tracking in Google Ads: Create a second conversion action in Google Ads for “Add to Cart” (category: Add to cart). Create a GTM tag triggered on the add_to_cart event. Use this for RLSA (remarketing lists for search ads) and for understanding drop-off between intent and purchase.
GA4 Ecommerce: If you have a GA4 property, the same purchase data layer event powers your GA4 ecommerce reports. Add a GA4 Event tag triggered on the purchase event with the ecommerce object passed as event parameters.
Enhanced Conversions: Once basic conversion tracking is confirmed, layer in Enhanced Conversions. On the order-received page, WooCommerce exposes the customer’s email address. GTM4WP can push hashed user data to the data layer — enable this in the plugin’s Events tab under “User data.” Then configure Enhanced Conversions in your Google Ads conversion action settings and map the hashed email field.
Key Takeaway
GTM4WP removes the hardest part of WooCommerce conversion tracking: getting clean, accurate ecommerce data into the data layer without writing custom PHP. The plugin handles the server-side data push, the GTM container placement, and the GA4 event structure. Your job in GTM is to read that data with variables, pass it to the Google Ads conversion tag, and verify the full click-to-conversion chain works.
The most common failure points are not in GTM — they are in the WooCommerce setup: cached pages replaying the purchase event, Elementor Pro overriding the order-received template, and revenue values that include or exclude tax/shipping inconsistently. Fix those first, then the GTM configuration is straightforward.
Related Posts
Why the Conversion Linker Tag Is Essential in Google Tag Manager
5 min read
How to Track Email Link Clicks in Google Tag Manager
8 min read
How to Track WhatsApp Clicks in Google Tag Manager
9 min read
Need Help With Your Google Ads?
I help e-commerce brands scale profitably with data-driven PPC strategies.
Get In Touch