Set Up GA4 Cross-Domain Tracking Between WordPress and Shopify

If you’re running a website on WordPress and selling products through Shopify, you’ve probably asked yourself this question:

How can I track users from one site to the other without losing the data?

Well, welcome to the magical world of GA4 Cross-Domain Tracking. Don’t worry—setting it up is easier than you might think.

Let’s walk through it step by step. Grab a coffee. This will be fun!

🏁 What Is Cross-Domain Tracking?

Usually, Google Analytics tracks sessions on a single domain. But if someone clicks from yourwordpresssite.com to yourshopify.com, that’s considered two different sessions.

That’s a problem! We want to know that the same person started on your blog and ended up buying your magical mug on Shopify.

Enter GA4 Cross-Domain Tracking. It passes user information between your WordPress and Shopify sites so you can see the whole journey.

🧰 What You’ll Need

  • A Google Analytics 4 property
  • Access to your WordPress admin
  • Access to your Shopify store
  • A little patience and curiosity 🙂

🔌 Step 1: Set Up GA4 on Both Sites

Before doing the cross-domain magic, you need GA4 running on both platforms.

Install GA4 on WordPress

If you’re using a plugin like Site Kit by Google or GA Google Analytics, just connect your GA4 Measurement ID. You can also paste the GA4 global site tag manually.

Here’s what it might look like:

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXX');
</script>

Replace G-XXXXXXX with your own Measurement ID.

Install GA4 on Shopify

  1. Go to your Shopify Admin
  2. Click on Settings > Customer Events
  3. Add your GA4 Measurement ID

If Customer Events isn’t available, you can manually add it in Shopify’s theme:

  1. Navigate to Online Store > Themes
  2. Click Actions > Edit Code
  3. Find and edit the theme.liquid file
  4. Paste the GA4 global tag in the <head> section

🔗 Step 2: Modify the GA4 Code for Cross-Domain Tracking

Now we need to tell GA4: “Hey, consider WordPress and Shopify as part of the same party.”

Edit Your Global Site Tag

Here’s the updated version of the GA4 code for both sites:

gtag('config', 'G-XXXXXXX', {
  'linker': {
    'domains': ['yourwordpresssite.com', 'yourshopifystore.com']
  }
});

Remember to replace those domain names with your actual domains.

Do this on both WordPress and Shopify!

🔍 Step 3: Enable Cross-Domain in Google Analytics 4

Now let’s tell GA4 itself to recognize cross-domain activity.

  1. Log into your GA4 account
  2. Click on Admin (bottom-left corner)
  3. Under the Property column, click Data Streams, then select your data stream
  4. Scroll down to Configure Tag Settings and click it
  5. Click Configure your domains

Now add your domains like this:

  • yourwordpresssite.com
  • yourshopifystore.com

Save it. Boom!

🧪 Step 4: Test It!

To make sure everything is working, use the Google Tag Assistant or Extensions like the GA Debugger.

Here’s what to check:

  • Open your WordPress site
  • Click a link that goes to your Shopify store
  • Watch the URL—it should carry some extra parameters like _gl=

That’s the linker doing its thing. If you see that, it’s working!

🌈 Bonus Tip: Use UTM Parameters for Tracking Campaigns

If you’re linking from blog posts to Shopify products, add UTM parameters to the links. It helps break down traffic sources.

For example:

https://yourshopifystore.com/product?utm_source=blog&utm_medium=article&utm_campaign=fall_launch

GA4 will pick this up and show you who clicked from what campaign.

🐞 Troubleshooting Tips

  • Make sure the gtag snippets are on both domains
  • Check that the domain names in the linker match exactly
  • Always publish or save theme changes in Shopify
  • If your session drops when crossing domains, revisit your linker setup

Don’t give up if it doesn’t work right away! Sometimes it takes a little while for GA4 reports to fully populate across multiple domains.

📊 Where to See the Data in GA4

Once everything is connected, open GA4 and go to:

  1. Reports
  2. Click Engagement > Pages and screens
  3. Look for page paths that include both your WordPress and Shopify sites

You can also go to Explorations and build a user path report! This lets you play detective and follow users through your entire funnel.

🎉 Final Thoughts

Setting up GA4 Cross-Domain Tracking between your WordPress site and Shopify store is like giving yourself superhero-level visibility over your customer journey.

You’ll know what pages people read before they click that “Buy Now” button.

With just a few pieces of script and some domain linking, you’re ready to make smarter decisions based on real data. 🚀

So go ahead—connect the dots. Your conversion funnel will thank you!