Google Ads Conversion Tracking for WooCommerce | Adslytics | Adslytics

Google Ads Tracking How-To Guide

Setting Up Google Ads Conversion Tracking for WooCommerce

By Muhammad Farooq · January 9, 2026 · 10 min read
Setting Up Google Ads Conversion Tracking for WooCommerce

WooCommerce and Google Ads: Why It Needs Custom Setup

WooCommerce gives you full control over your ecommerce store — including your tracking setup. Unlike Shopify, there is no single "official" Google Ads integration. This flexibility is powerful but means more responsibility: you need to configure Google Ads conversion tracking properly yourself.

The good news: with Google Tag Manager and WooCommerce's built-in ecommerce data layer support, you can achieve highly accurate conversion tracking with dynamic values, enhanced conversions, and deduplication.

Step 1: Set Up the WooCommerce Data Layer

WooCommerce does not push purchase events to the data layer by default. You need to add this, either via a plugin or custom code.

Option A: Plugin (Simplest)

Install a dedicated GTM or data layer plugin for WooCommerce. Popular options include:

  • WooCommerce Google Tag Manager plugin (free and premium versions available) — pushes ecommerce events including purchase to the data layer on the order confirmation page
  • DataLayer for WooCommerce — specifically designed to push GA4-compatible ecommerce data layer events

After installing, verify the data layer is firing correctly by completing a test order and checking the browser console for the purchase event.

Option B: Custom Code in functions.php

Add the following to your theme's functions.php or a custom plugin. This fires on the WooCommerce thank-you page:

add_action('woocommerce_thankyou', 'push_purchase_to_datalayer', 10, 1);
function push_purchase_to_datalayer($order_id) {
    if (!$order_id) return;
    $order = wc_get_order($order_id);
    if (!$order) return;

    $items = [];
    foreach ($order->get_items() as $item) {
        $product = $item->get_product();
        $items[] = [
            'item_id'   => (string)$product->get_id(),
            'item_name' => $product->get_name(),
            'price'     => (float)$order->get_item_subtotal($item, false),
            'quantity'  => $item->get_quantity(),
        ];
    }

    $customer_email = $order->get_billing_email();
    $first_name     = $order->get_billing_first_name();
    $last_name      = $order->get_billing_last_name();

    echo "<script>
    window.dataLayer = window.dataLayer || [];
    dataLayer.push({
      event: 'purchase',
      ecommerce: {
        transaction_id: '" . esc_js($order->get_order_number()) . "',
        value: " . (float)$order->get_total() . ",
        currency: '" . esc_js(get_woocommerce_currency()) . "',
        items: " . json_encode($items) . "
      },
      user_data: {
        email: '" . esc_js($customer_email) . "',
        first_name: '" . esc_js($first_name) . "',
        last_name: '" . esc_js($last_name) . "'
      }
    });
    </script>";
}

This code runs on the order confirmation (thank-you) page and pushes a purchase event with transaction ID, value, currency, items, and customer data for enhanced conversions.

Step 2: Install GTM on WooCommerce

  1. In your WordPress dashboard: install the "Insert Headers and Footers" plugin or a GTM-specific plugin like "GTM4WP"
  2. Add the GTM container head snippet to the head of every page
  3. Add the GTM noscript body snippet immediately after the opening body tag
  4. Confirm GTM is loading on all pages using GTM Preview Mode

Step 3: Configure the Google Ads Purchase Tag in GTM

  1. Create Data Layer Variables in GTM for: ecommerce.transaction_id, ecommerce.value, ecommerce.currency
  2. Create a User Provided Data variable reading from user_data.email (for enhanced conversions)
  3. Create a Custom Event trigger: Event Name equals "purchase"
  4. Create a Google Ads Conversion Tracking tag:
  • Conversion ID and Label: from your Google Ads purchase conversion action
  • Conversion Value: Data Layer Variable for ecommerce.value
  • Currency Code: Data Layer Variable for ecommerce.currency
  • Order ID: Data Layer Variable for ecommerce.transaction_id
  • Include user-provided data: Yes, using your User Provided Data variable
  • Trigger: your "purchase" Custom Event trigger
  1. Test in GTM Preview Mode: place a WooCommerce test order (use the WooCommerce BACS or Cheque payment method in test mode) and confirm the tag fires with the correct values
  2. Publish the GTM container

Deduplication: Preventing Double Purchase Conversions

The WooCommerce thank-you page can sometimes be visited multiple times — the customer may reload it or return from the email confirmation. Without deduplication, this generates duplicate purchase conversions.

Two deduplication strategies:

  • Order ID in the conversion tag: Google ignores duplicate conversions with the same Order ID within 24 hours. Always pass the transaction_id as the Order ID field in your GTM tag — this is the most important deduplication layer.
  • Server-side session check: Use PHP to set a WordPress option or transient after the first page load, and only push the data layer event if this flag has not been set. This prevents the data layer push on reloads.

Avoiding Common WooCommerce Tracking Conflicts

Conflict: Multiple Google Tags from Different Plugins

Many WooCommerce plugins install their own Google Analytics or Google Ads tags. Check for plugins that might add duplicate Google tags:

  • WooCommerce Google Analytics Integration
  • MonsterInsights
  • Google Listings and Ads (Woo's native Google integration)
  • Any SEO plugin with built-in analytics features

If you are managing tags through GTM, disable all other Google Ads conversion tags from plugins. Having two tags for the same conversion is a common cause of inflated conversion counts — check our Conversion Tracking Fix and Debugging service if you suspect this.

Conflict: WooCommerce Blocks Checkout

WooCommerce's newer block-based checkout (introduced in WooCommerce 8+) uses a different DOM structure than the classic checkout. Some data layer plugins may not fully support it.

Test your setup with the block checkout if you have migrated to it. The thank-you page (order-received) typically still works with the functions.php code above, as it is rendered server-side regardless of checkout type.

Verifying Your Setup

  1. Enable WooCommerce's test payment methods (BACS or Cheque) and place a test order
  2. On the order confirmation page, open GTM Preview and confirm the purchase event fires with the correct transaction_id, value, and currency
  3. Confirm the Google Ads Conversion tag fires once (not twice) with the correct Conversion ID and value
  4. Check Google Tag Assistant for the Enhanced Conversions data — user_data.email should appear as a hashed field
  5. After 48 hours, check Google Ads conversions to confirm the test order appears

Summary

WooCommerce conversion tracking for Google Ads requires a proper data layer push on the order confirmation page, GTM for tag management, Order ID deduplication, and enhanced conversions for maximum attribution coverage.

Avoid relying on multiple competing plugins that each try to manage Google tags — consolidate everything through GTM for clean, controllable tracking.

For professional WooCommerce conversion tracking setup, see our Google Ads Conversion Tracking service and our Google Tag Manager setup service.

Need accurate conversion tracking for your WooCommerce store? Contact Adslytics.

Need expert tracking setup?

Our Google Tag Manager experts have delivered 500+ tracking setups with a 98% success rate.

Get a Free Consultation →
← Back to Blog
Muhammad Farooq

Author

Muhammad Farooq GTM & Analytics Expert · Adslytics Founder

Tracking specialist with 10+ years of experience in Google Tag Manager, GA4, Server-Side Tracking, and Google Ads. Founder of Adslytics — a dedicated analytics agency with a 98% success rate across 232+ projects on Upwork.

Top Rated Plus LinkedIn Visit the author's profile →