🛠️ Setup Tutorial

How to Setup GA4 Cross-Domain Tracking Between WordPress and Shopify

By Dimsquid EngineeringPublished Aug 4, 20265 min read

Running a WordPress website for content, landing pages, or WooCommerce alongside a separate Shopify store for checkout is one of the most popular e-commerce architectures. However, without proper cross-domain tracking, Google Analytics 4 treats every single Shopify purchase as a separate session originating from (direct) / none.

In this step-by-step guide, we will walk through how GA4 cross-domain tracking works, how to configure domain streams, and how to decorate links between WordPress and Shopify to ensure 100% session continuity.

Step 1: Configure Data Streams in GA4 Admin

Before decorating URLs, you must tell Google Analytics 4 that your WordPress domain and your Shopify domain belong to the same property stream:

  1. Open Google Analytics 4 and navigate to Admin → Data Streams.
  2. Select your Web Data Stream and click Configure Tag Settings.
  3. Under Settings, click Configure Your Domains.
  4. Add a rule: Match type = Contains, Domain = yoursite.com (your WordPress domain).
  5. Add a second rule: Match type = Contains, Domain = myshopify.com (or your custom Shopify checkout domain).
  6. Click Save.

Step 2: Enable Link Decoration on Outbound Links

Configuring domains in GA4 tells Google Analytics to allow cross-domain parameters, but it does not add the parameters to your WordPress buttons automatically.

When a visitor clicks a checkout button on WordPress, the destination URL must contain the _gl query parameter:

https://yourstore.myshopify.com/cart/add?id=123&_gl=1*1a2b3c*ga*MTIzNDU2Nzg5...

You have two choices for decorating your WordPress links:

Option A: Manual GTM Container

Requires creating custom Javascript DOM listeners in Google Tag Manager. Warning: GTM triggers fail on slide-out AJAX carts and form actions.

Option B: GA4 Linker Plugin

Zero code required. Install the plugin, enter your Shopify domain, and it automatically decorates links, forms, and slide-out AJAX carts.

Step 3: How to Test & Verify Your Cross-Domain Tracking

Once configured, test session stitching in your browser:

  1. Open an Incognito browser window and navigate to your WordPress landing page with a test UTM parameter: yoursite.com?utm_source=test_source.
  2. Click any button pointing to your Shopify store.
  3. Inspect the destination Shopify address bar — confirm that _gl=1*... appears in the query string.
  4. Open GA4 DebugView — verify that events on WordPress and checkout on Shopify appear under the exact same Client ID.