WooCommerce8 min read1 view

WooCommerce Google Ads add-to-cart tracking with GTM

Track WooCommerce add-to-cart events in Google Ads with GTM4WP, exact trigger names, value mappings and optional feed-matched remarketing.

Watch on YouTube

Jump to the code

The short answer

Track WooCommerce cart additions with a Google Ads conversion tag triggered by GTM4WP's add_to_cart event. Google requires a conversion ID and an action-specific labelsupport.google.com. This guide is for store owners and implementers who want to observe cart activity and test optional product remarketing without treating it as a sale.

  • If you only want to observe cart additions, review Secondary and custom-goal settings.
  • Use add_to_cart, with underscores, as the GTM trigger.
  • Keep conversion labels out of ordinary remarketing tags.
  • Steps and settings checked against Google and GTM4WP documentation on 25 October 2026.

Ask an assistant

ChatGPTClaudePerplexity

FREE CALL

30 MIN

Meta stopped counting your leads? Get them counted again.

  1. Pick a time
  2. Check your Meta account with Hassan
  3. See what to do next

On a free 30-minute call, Hassan checks your Meta account with you and shows you what to do next.

Book my free recovery callFree 30-minute call with Hassan.

Not ready to talk? Run a free check

How do I track WooCommerce add to cart in Google Ads?

Send the cart event to its own conversion action, then test the values on the same event. If GTM is missing, start with the WooCommerce Google Ads page-view setup. The video shows the older configuration; the written steps below correct the trigger, tag fields and testing method.

What access do I need before setting up cart tracking?

Use a staging store, its GTM web container and the intended Ads account. Record existing plugins or tags that already send cart conversions; this guide is the wrong fix for an event that is already sent correctly.

1. Record the test setup

  1. Open WordPress plugin settings.
  2. Open the GTM workspace.
  3. Open the Ads conversion action you intend to use.
  4. Record the staging URL, container ID, account and existing sender.

Keep your consent configuration in place.

Done when the staging URL, container ID, account and existing sender are recorded.

Which WordPress plugin supplies the data layer?

GTM4WP by Thomas Geiger installs GTM container code and exposes a data layerwordpress.org. Use that plugin for this guide; another plugin may have a different payload.

2. Connect GTM4WP to the staging container

  1. Install or open GTM4WP.
  2. Enter the staging container ID in its settings.
  3. Save the settings.

Avoid a second installation of the same container in the theme.

Done when the saved ID matches the container you will preview.

How do I check that GTM loads on WooCommerce?

GTM Preview tests an unpublished workspace on a normal web pagesupport.google.com.

3. Connect Preview

  1. Select Preview.
  2. Enter the staging store URL.
  3. Choose Connect.

Done when Tag Assistant shows the intended container connected on the product page.

Should add to cart be a primary conversion?

Use Secondary for this observation exercise; choose bidding goals separately with the account owner.

4. Select the cart conversion action

Choose the action for cart additions, not the purchase action.

  1. Use a dedicated website conversion action named for Add to cart.
  2. In Goals > Conversions > Summary, open it.
  3. Open Tag setup > Use Google Tag Manager.
  4. Copy its Conversion ID and Conversion Label; Google documents the ID as account-specific and the label as action-specificsupport.google.com.
  5. For observation, choose Secondary.
  6. Keep it out of custom bidding goals: secondary actions are still used for bidding when included in a custom goalsupport.google.com.
  7. Choose different values for each conversion for this event-value example, following Google's value settingssupport.google.com.

Done when your notes contain this action's ID, label and chosen value setting.

How do I enable WooCommerce cart data in GTM4WP?

The Track e-commerce setting enables GTM4WP's WooCommerce data layergtm4wp.com.

5. Enable ecommerce data

  1. Open GTM4WP settings > WooCommerce > General. In older 1.x versions it is under Integration > WooCommercegtm4wp.com.
  2. Enable Track e-commerce.
  3. Save the settings.
  4. Refresh the staging store.

Done when an add-to-cart test creates add_to_cart with an ecommerce object in Preview.

Which cart value should I send to Google Ads?

Use the value attached to this cart event. GTM4WP's cart handlers calculate value from the affected products and quantitiesraw.githubusercontent.com.

6. Inspect the added product

  1. Add a chosen variant and quantity.
  2. At add_to_cart, inspect ecommerce.value, ecommerce.currency and ecommerce.items.
  3. Compare the amount and quantity with what was actually added, including a cart drawer or quick-add route if the store has one.

Done when those values match the tested cart change.

Do I need a Conversion Linker as well as the Google tag?

Check the existing Google tag before adding a linker.

7. Confirm the base tag

  1. Open the container's current Google tag configuration.
  2. Reuse the Google tag connected to the intended Ads account.
  3. If it is missing, create Google tag, following Google's setup instructionssupport.google.com.
  4. For a new tag, enter that account's Google tag ID.
  5. For a new tag, select Initialization - All Pages.
  6. If your installation still uses a Conversion Linker, check its landing-page coverage instead of adding another.

Google says a separate Conversion Linker is unnecessary when the container loads a Google tag on every pagesupport.google.com.

Done when Preview shows the intended Google tag firing on the staging page.

What trigger and variables should I use for add to cart?

Use the exact data-layer event name add_to_cart.

8. Create the cart variables and trigger

Use the payload inspected in step 6.

A Data Layer Variablesupport.google.com reads a named value from the data layer, the data your store exposes to GTM. A Custom Event trigger tells GTM when to run the tag.

  1. Create the variables in the table below using Version 2 for nested paths.
  2. Create a Custom Event trigger that uses add_to_cart.
  3. Leave regular-expression matching off.

DLV - Value

Data Layer Variable name
ecommerce.value

DLV - Currency

Data Layer Variable name
ecommerce.currency
Variable names are local names you create; the right column must match the payload.

Done when the saved paths and trigger name match this table and the event payload.

How do I configure the add-to-cart conversion tag?

Use the cart action's label and map its value and currency.

9. Save the conversion tag

Google supports value, currency and transaction ID in addition to the required ID and labelsupport.google.com.

  1. In Tags > New > Google Ads Conversion Tracking, create a separate tag for this conversion action.
  2. Enter the fields in the table below.
  3. Save the tag.

Tag type

Set it to
Google Ads Conversion Tracking

Conversion ID

Set it to
The intended Google Ads account's ID

Conversion Label

Set it to
The label from this event's conversion action

Conversion Value

Set it to
{{DLV - Value}}

Currency Code

Set it to
{{DLV - Currency}}

Transaction ID

Set it to
Leave empty; this event is not an order

Trigger

Set it to
Custom Event: add_to_cart
The conversion action is selected by its label, not by the GTM trigger name.

An empty or undefined Conversion Value is sent as 0support.google.com. If the value variable is missing, fix the payload before proceeding. Google requires numeric conversion values and an ISO 4217 currency codesupport.google.com.

Done when reopening the tag shows the intended action, these mappings and the event-specific trigger.

How do I send cart products for dynamic remarketing?

Use a separate remarketing tag with feed-matched product IDs.

10. Add optional product remarketing

Skip this step if you do not have a verified Merchant Center feed mapping.

Add dynamic remarketing only after confirming the product identifiers against the feed. Google's retail schema requires id to match a Merchant Center id, item_group_id or display_ads_idsupport.google.com. A GA4 item_id is not automatically that match.

  1. Create a Version 2 Data Layer Variable named DLV - Items for ecommerce.items.
  2. Only if each non-empty item_id already matches your feed, create a Custom JavaScript variable named JS - Ads items with the mapping below.

Otherwise stop here and have the feed owner supply the mapping; do not invent a prefix or substitute a product title.

javascript10 lines
function () {  var items = {{DLV - Items}};  if (!Array.isArray(items)) return [];  return items.filter(function (item) {    return item && item.item_id != null &&      String(item.item_id).trim() !== "";

4 more lines of JavaScript

  • Copy and download
  • Emailed to you

Unlock this snippet

Two details, and the full code is yours

No account needed. Unlock once and every snippet on the blog opens.

We email you a copy.

  1. Create JS - Ads item count as the Custom JavaScript function below.
javascript
function () {
  return {{JS - Ads items}}.length;
}
  1. Duplicate the event trigger for this remarketing tag.
  2. Choose Some Custom Events, with JS - Ads item count greater than 0.
  3. Keep the conversion tag on its original trigger so missing product IDs do not discard its value.
  4. Create the Google Ads Remarketing tag with the fields in the table below.

Tag type

Set it to
Google Ads Remarketing

Conversion ID

Set it to
The account's remarketing Conversion ID

Conversion Label

Set it to
Leave empty unless the remarketing list itself supplies one

Send dynamic remarketing event data

Set it to
Checked

Event Name

Set it to
add_to_cart

Event Value

Set it to
{{DLV - Value}}

Event Items

Set it to
{{JS - Ads items}}

Trigger

Set it to
add_to_cart with JS - Ads item count greater than 0
The items field receives an array, not JSON text.

Google documents Event Name, Event Value and Event Items for dynamic remarketingsupport.google.com. Do not paste a conversion-action label into a remarketing tag: Google warns that doing so inflates conversion countssupport.google.com.

Done when Preview shows the expected event name, feed-matched IDs and value; an item without an ID is absent, and an all-empty array prevents only the remarketing tag from firing.

How do I test the cart conversion before release?

Repeat cart actions in Preview and compare the fired tags with the cart.

11. Test success, failure and consent

  1. Refresh Preview.
  2. Add a simple product.
  3. Add a variant.
  4. Try an unsuccessful cart action.
  5. Inspect the conversion label, value and currency on each fired tag.
  6. Exercise both consent choices using the store's existing consent setup.

Done when successful additions match the cart, failed additions produce no successful-cart conversion, and consent behavior matches your plan.

Do I need to publish GTM to test this setup?

No. Preview runs the draft for your test browser before publicationsupport.google.com. Keep these changes as a reviewed draft and move the tested setup through your normal release process.

What should I fix if cart conversions look wrong?

Check the event name, the sender and the remarketing label first.

What changed in this guide

  • 25 October 2026: Corrected GTM4WP event and field mappings, conversion versus remarketing labels, feed IDs, goal settings and Preview-only testing.

Sources

14 sources
  1. 1Google requires a conversion ID and an action-specific label↩
  2. 2GTM4WP by Thomas Geiger installs GTM container code and exposes a data layer↩
  3. 3GTM Preview tests an unpublished workspace on a normal web page↩
  4. 4secondary actions are still used for bidding when included in a custom goal↩
  5. 5Google's value settings↩
  6. 6The Track e-commerce setting enables GTM4WP's WooCommerce data layer↩
  7. 7GTM4WP's cart handlers calculate value from the affected products and quantities↩
  8. 8GTM4WP exposes checkout data separately↩
  9. 9Google's setup instructions↩
  10. 10Google says a separate Conversion Linker is unnecessary when the container loads a Google tag on every page↩
  11. 11Data Layer Variable↩
  12. 12Google's retail schema requires id to match a Merchant Center id, item_group_id or display_ads_id↩
  13. 13Google documents Event Name, Event Value and Event Items for dynamic remarketing↩
  14. 14Do not paste a conversion-action label into a remarketing tag: Google warns that doing so inflates conversion counts↩