Search here to get answers to your questions.

Google Analytics GA4 Data Layer Integration (Pro)

When you redirect customers away from the default WooCommerce Thank You page, standard Google Analytics ecommerce tracking breaks, because GA4 looks for its purchase event on that original page. ThankRedirect Pro solves this by pushing a complete purchase event to the Google Analytics Data Layer on your custom Thank You page instead.

Why This Matters

If you’re running Google Ads or relying on GA4 for revenue reporting, accurate conversion tracking is critical. Without this integration, every redirected order is an invisible conversion — you’re spending money on ads without seeing the results.

ThankRedirect’s Data Layer integration fires a full ecommerce purchase event on your custom Thank You page — carrying all the order data GA4 needs to attribute revenue correctly.

What Data Is Pushed

ThankRedirect pushes the following to window.dataLayer:

  • Transaction ID
  • Order value (total)
  • Tax amount
  • Shipping amount
  • Currency code
  • Coupon codes applied
  • Items array, including product ID, name, quantity, and price for each item

This matches GA4’s standard enhanced ecommerce purchase event format.

Setting Up the Data Layer Integration

Step 1: Enable in ThankRedirect

  1. Go to ThankRedirect → Settings
  2. Find the Analytics section
  3. Toggle on Enable Google Analytics Data Layer
  4. Optionally, set a Custom Event Name — defaults to purchase if left blank
  5. Save your settings

Step 2: Make Sure Google Tag is Firing on Your Thank You Page

ThankRedirect pushes data to window.dataLayer — but you still need Google Tag Manager (GTM) or the GA4 global site tag (gtag.js) loaded on your custom Thank You page to pick it up.

If you’re using Google Tag Manager:

  1. Make sure your GTM container is firing on all pages (or at minimum on your Thank You page URL)
  2. Your existing GA4 configuration tag should pick up the purchase Data Layer event automatically if enhanced ecommerce is enabled in GA4

If you’re using the GA4 snippet directly (gtag.js), make sure it’s loaded on your custom Thank You page through your theme or a plugin like Site Kit by Google.

Step 3: Test It

  1. Enable GTM Preview mode (or use Google Tag Assistant)
  2. Place a test order and follow the redirect to your custom Thank You page
  3. In GTM Preview, look for a Data Layer push event containing event: "purchase" (or your custom event name) with order data

Custom Event Name

By default, ThankRedirect uses purchase as the event name — matching GA4’s standard ecommerce event. If your GTM setup uses a different event name, you can change it in ThankRedirect’s Analytics settings.

Important Notes

  • The Data Layer push fires via a script injected into the <head> of your custom Thank You page, before the rest of the page loads, ensuring GA4 captures it reliably
  • This integration is separate from any WooCommerce GA4 plugin you may have installed, it only fires on the redirect destination page, not on the original WooCommerce Thank You page
  • If you already use a WooCommerce + GA4 plugin, check that it isn’t also firing a purchase event on the redirect destination to avoid double-counting
Pro tip: After enabling this integration, check GA4’s Realtime report while placing a test order. You should see the purchase event appear within seconds of landing on your custom Thank You page.
Last Updated: May 28, 2026