How to Setup GA4 Cross-Domain Tracking Between WordPress and Shopify
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:
- Open Google Analytics 4 and navigate to Admin → Data Streams.
- Select your Web Data Stream and click Configure Tag Settings.
- Under Settings, click Configure Your Domains.
- Add a rule: Match type =
Contains, Domain =yoursite.com(your WordPress domain). - Add a second rule: Match type =
Contains, Domain =myshopify.com(or your custom Shopify checkout domain). - 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:
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:
- Open an Incognito browser window and navigate to your WordPress landing page with a test UTM parameter:
yoursite.com?utm_source=test_source. - Click any button pointing to your Shopify store.
- Inspect the destination Shopify address bar — confirm that
_gl=1*...appears in the query string. - Open GA4 DebugView — verify that events on WordPress and checkout on Shopify appear under the exact same Client ID.
Automate GA4 Cross-Domain Linking in 60 Seconds
Skip the manual GTM scripts. GA4 Linker for Shopify decorates links, forms, and dynamic cart drawers automatically on WordPress.
Download GA4 Linker Plugin →