Turn On WooCommerce Ecommerce Tracking in Google Tag Manager with GTM4WP and AI
GA4 ecommerce events from your WooCommerce store in the data layer, switched on after your yes and checked on a product page.
Prerequisites
A site connected to WPVibe running WooCommerce and GTM4WP (Google Tag Manager for WordPress) 2.1 or newer (tested on 2.1.1, free, with WooCommerce 11.2.1) on WordPress 6.9 or newer (tested on 7.1.4), with an administrator account. A Google Tag Manager container already set in GTM4WP.
My WordPress store uses WooCommerce and GTM4WP (Google Tag Manager for WordPress). Turn on ecommerce tracking so my Tag Manager container gets GA4 ecommerce events. 1. Run discover_abilities with category gtm4wp. If no gtm4wp ability is there, stop and tell me to install or update the free GTM4WP plugin (Google Tag Manager for WordPress, 2.1 or newer, on WordPress 6.9 or newer), or that the site may have switched GTM4WP's abilities off. If the others are there but gtm4wp/update-settings is not, tell me this site keeps GTM4WP's abilities read-only, so the change is made on the GTM4WP settings screen, and stop. 2. Run gtm4wp/get-status. If the woocommerce module's integration is not active, tell me WooCommerce is not active and stop. If containers is empty and placement is not off, tell me no container is set yet, so GTM4WP writes no data layer and nothing reaches Tag Manager, and ask whether to go on anyway. If I go on, skip the page check in step 7. 3. Run gtm4wp/get-settings with modules woocommerce and include_schema true, and keep its values_hash. If integrate-woocommerce-track-enhanced-ecommerce is already true, tell me it is on, still check the two personal data options as step 4 says, and run step 5 only if I ask to turn one off; otherwise go to step 6. 4. Run rest_api GET /wp/v2/plugins with status active. If Google Analytics for WooCommerce or MonsterInsights is active, tell me it sends its own Google Analytics data, so purchases can be counted twice if my GA4 tags are also in Tag Manager, and ask whether to go on. Tell me what turning on Track e-commerce adds to the data layer: view_item_list and select_item on product lists, view_item on product pages, add_to_cart and remove_from_cart, view_cart, begin_checkout, add_shipping_info, add_payment_info, and purchase on the order received page. By default the purchase counts when an order first reaches Processing, On hold or Completed (integrate-woocommerce-purchase-track-statuses), and only for orders younger than integrate-woocommerce-order-max-age minutes, so an old order page viewed again is not counted twice. Leave every other WooCommerce option as it is. Look at integrate-woocommerce-customer-data and integrate-woocommerce-order-data: they put customer names, emails, phone numbers and addresses into the page. If both are off, tell me they stay off. If either is on, tell me what it exposes and ask whether to turn it off as part of this change. 5. Run gtm4wp/export-settings and keep its answer as the backup of my settings: to undo, send the old values from it with gtm4wp/update-settings after the same confirmation, never with import-settings, which replaces every setting. Show me each option you will change with its current value and its new value, and ask: Confirm this change? Wait for my yes. Then run gtm4wp/update-settings with only those options under values, and expected_hash set to the values_hash from get-settings. If it says the settings changed in between, read them again and ask me again. If it says changing settings through the Abilities API is switched off, tell me to change it on the GTM4WP settings screen and stop. If it lists an option under errors, tell me its message: that option was not saved. Change integrate-woocommerce-track-enhanced-ecommerce to true unless it is already on, and turn off only the personal data options I asked to turn off. 6. Run gtm4wp/get-status again and explain any problem it lists. 7. Run rest_api GET /wc/store/v1/products with per_page 1 and type simple, and take the product's permalink as PRODUCT_URL. If there is none, skip this check and say so: the store has no simple product to test on. Run get_page_html for PRODUCT_URL with selector #gtm4wp-additional-datalayer-pushes-js-after and confirm it holds "event":"view_item" with that product's name and price. If the whole page comes back instead, run gtm4wp/get-settings with keys integrate-woocommerce-track-enhanced-ecommerce and check it is true; if it is, a page cache or a plugin that combines scripts may be changing the page: tell me so. 8. List each option you changed with its old and new value. Tell me these events are now in the data layer (if no container is set, only once one is), and that my container needs GA4 event tags that send them to Google Analytics before any revenue shows there. The other events fire in the visitor's browser, so tell me to check them with Tag Manager's Preview mode: view a product, add it to the cart, and place a test order.
Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:
Run the “Turn On WooCommerce Ecommerce Tracking in Google Tag Manager with GTM4WP and AI” recipe from the WPVibe cookbook on my connected site.
Your store runs Google Tag Manager, but GA4 shows page views and no revenue: no product views, no add to cart, no purchases. Ecommerce tracking in GTM4WP is one switch, buried among two dozen WooCommerce options, and getting the purchase event right is what everyone worries about.
The AI checks WooCommerce is active and a container is set, explains what the switch adds (the standard GA4 ecommerce events, from product lists to the purchase on the order received page), and turns it on after your yes. It leaves the options that put customer names, emails and addresses into the page off, then checks a product page for the view_item event and reports any plugin GTM4WP warns would count purchases twice.
This puts the events in the data layer; your Tag Manager container still needs GA4 event tags that send them to Google Analytics. GTM4WP’s GA4 setup guide shows the tags. Test with Tag Manager’s Preview mode and a test order. To add a container first, use this recipe.
Outcome
Product views, cart, checkout and purchase events from your store reach your Tag Manager data layer, ready for GA4 tags.