Shopify and WordPress: How to Run Both and Track Every Sale Back to Its Source

A lot of businesses end up running both Shopify and WordPress at the same time — not because it’s the obvious choice, but because each platform is genuinely better at something the other isn’t.

WordPress dominates for content, SEO, and lead generation. Shopify dominates for ecommerce: checkout reliability, payment processing, inventory, shipping integrations. Businesses that want both a high-performing content engine and a polished online store often find they need both.

The problem that doesn’t get addressed clearly is attribution: when someone reads a WordPress blog post, subscribes to an email list, and eventually buys in Shopify, how do you know which content actually drove that sale?

This post covers how to set up and connect WordPress and Shopify, and then — the part most guides skip — how to track lead source attribution across both platforms so you know what marketing is actually working.

Why Businesses Run WordPress and Shopify Together

Shopify is purpose-built for ecommerce. Its checkout, payment processing, inventory management, and shipping integrations are best-in-class. Shopify Payments handles 3D Secure, fraud protection, and international currencies without custom development. Setting up a store with 50 SKUs takes hours, not weeks.

But Shopify is mediocre at content. Its blogging tools are basic. Its URL structure is rigid. The SEO flexibility that WordPress gives you through plugins like Yoast or Rank Math simply doesn’t exist in the same form in Shopify. Brands that need a robust content strategy — blog posts, landing pages, guides, lead magnets — quickly run into Shopify’s ceiling.

WordPress is the opposite. It’s exceptional at content architecture, SEO optimization, lead capture, and CMS flexibility. WooCommerce can make it work as an ecommerce platform, but WooCommerce is meaningfully more complex to run and maintain than Shopify, especially for stores with significant transaction volume.

The practical solution many businesses land on: WordPress for the content site (blog, SEO landing pages, lead capture) and Shopify for the store. The WordPress site drives organic traffic and captures leads. Shopify handles the actual transactions.

Integration Options: How to Connect WordPress and Shopify

There are several ways to structure the relationship between the two platforms, depending on how much overlap you want.

Separate Domains, Cross-Linked

The simplest setup: your WordPress site lives at yourdomain.com and your Shopify store lives at store.yourdomain.com (or shop.yourdomain.com, or a subdomain of your choice). You link between them, but they’re distinct environments with separate logins, analytics, and tracking.

This works fine operationally but creates an attribution gap: customers who arrive via WordPress and convert in Shopify cross a domain boundary that breaks standard cookie-based tracking.

WordPress With a Shopify Buy Button Embed

Shopify’s Buy Button feature lets you generate embeddable product cards or cart widgets that you paste into WordPress pages. The customer browses on WordPress but the checkout is served by Shopify. This keeps customers on a single domain for browsing while still using Shopify’s checkout infrastructure.

The Shopify Buy Button is straightforward for simple product setups but has limits: it’s best for single products or small collections, not a full browseable catalog. If you need customers to shop across many products, the Buy Button approach gets clunky.

WordPress as the Front-End, Shopify as Headless

A more sophisticated setup: use Shopify’s Storefront API in headless mode, with WordPress serving the front-end experience. Shopify handles inventory, payments, and order management in the background while WordPress controls what the customer sees. This gives you full WordPress content flexibility with full Shopify commerce infrastructure.

Headless commerce is a real technical investment — it requires a developer to build and maintain the integration. For most small and mid-size businesses, the Buy Button approach or separate-domain setup is the practical choice. Headless is worth the investment when you need both at scale.

The Attribution Gap Between WordPress and Shopify

Here’s where things get messy for businesses running both platforms separately.

When a visitor arrives at your WordPress site from a Google ad, organic search, or email campaign, their source is captured in the URL as UTM parameters. WordPress can read those parameters and, if you have the right tracking in place, store them against that visitor’s cookie. If they convert via a contact form or lead magnet on WordPress, you have their lead source.

But if they leave WordPress and complete a purchase in Shopify, a few things can happen:

  • The cookie with their WordPress lead source doesn’t transfer to the Shopify domain (cookies are domain-scoped).
  • The UTM parameters in their original WordPress URL aren’t automatically passed along to Shopify.
  • Shopify’s own analytics records the sale but attributes it to direct traffic or to whichever channel last touched the customer on the Shopify domain — not the original WordPress referral.

The result: you spend money driving traffic to your WordPress content, some of that traffic converts to Shopify sales, but you can’t connect the sale back to what drove it. You’re running content marketing and paid ads on WordPress with no way to measure their contribution to Shopify revenue.

How to Track Lead Source Across WordPress and Shopify

Option 1: UTM Pass-Through via URL Parameters

The simplest cross-domain attribution method: capture UTM parameters when a visitor lands on WordPress, and append them to any links that go to your Shopify store.

The implementation requires two pieces:

Step 1: Capture UTMs on WordPress. Add a small JavaScript snippet (or use a plugin like Attributer, Marketing Attribution by Leadsbridge, or a similar tool) that reads UTM parameters from the URL on page load and stores them in sessionStorage or a cookie.

Step 2: Append UTMs to Shopify links. Another snippet rewrites any link on your WordPress pages that points to your Shopify store, appending the stored UTM values as query parameters to those links. When a visitor clicks to the store, they arrive with the same UTM parameters they came in on, and Shopify’s analytics records the correct source.

// Capture UTMs from current URL
const urlParams = new URLSearchParams(window.location.search);
const utmKeys = ['utm_source','utm_medium','utm_campaign','utm_content','utm_term'];
const utms = {};
utmKeys.forEach(k => { if (urlParams.get(k)) utms[k] = urlParams.get(k); });
if (Object.keys(utms).length) sessionStorage.setItem('wp_utms', JSON.stringify(utms));

// On page load, rewrite Shopify store links to include stored UTMs
const stored = sessionStorage.getItem('wp_utms');
if (stored) {
  const params = JSON.parse(stored);
  document.querySelectorAll('a[href*="yourstore.myshopify.com"], a[href*="store.yourdomain.com"]').forEach(link => {
    const url = new URL(link.href);
    Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
    link.href = url.toString();
  });
}

This gives Shopify’s analytics (and any Google Analytics 4 property connected to Shopify) the UTM data needed to attribute the sale back to the original WordPress traffic source.

Option 2: First-Party Attribution Tools That Span Both Platforms

Tools like Sales Provenance are designed specifically for this cross-platform attribution problem. When a visitor arrives at your WordPress site, the tool captures their lead source (UTM, referrer, channel). If that same visitor later converts in Shopify, the attribution data is connected at the customer level — not just the session level — so you have accurate first-party source data regardless of when or where the conversion happened.

This is more robust than session-level UTM pass-through for a few reasons:

  • It handles multi-session journeys (someone visits from an ad, comes back organically a week later, then buys).
  • It doesn’t break if the visitor’s browser blocks third-party cookies or limits session storage.
  • It connects lead source data to actual customer records, so you can see not just “this sale came from organic search” but “this customer from organic search spent $X and has been a customer for Y months.”

Option 3: GA4 Cross-Domain Tracking

If you have Google Analytics 4 on both WordPress and Shopify (Shopify has a GA4 integration through Google & YouTube channel), you can configure GA4 cross-domain tracking to follow users across both domains within the same session.

GA4 cross-domain tracking works by adding a linker parameter to URLs when a user clicks from one domain to another. It stitches sessions together so that a user who arrives on WordPress and clicks to Shopify is tracked as one continuous session with the original source preserved.

To configure this in GA4: go to Admin > Data Streams > Configure Tag Settings > Configure your domains. Add both your WordPress domain and your Shopify store domain. GA4 will automatically handle the cross-domain linker.

GA4 cross-domain tracking solves the session continuity problem but has one limit: it only works for users who click directly from WordPress to Shopify within the same session. Users who visit WordPress, leave, and return to Shopify later via a different path won’t have their journeys connected.

Shopify Analytics and What You Can See Natively

Shopify’s built-in analytics tracks sessions and sales by referring source on the Shopify domain — the last touchpoint before the purchase on Shopify. If a customer arrives at Shopify directly from a Google organic search result, Shopify records that as the source. If they arrive from your Shopify product link on your WordPress site, Shopify records the referring domain (your WordPress site) as the source.

What Shopify can’t tell you natively: what drove them to your WordPress site in the first place. That first-touch data lives on the WordPress side and has to be explicitly passed to Shopify through one of the methods above for it to appear in Shopify’s attribution reporting.

A Practical Setup for Most Businesses

For a business running both platforms without dedicated development resources:

  1. Run WordPress on your main domain for blog, SEO landing pages, and lead capture. Run Shopify on a subdomain (store.yourdomain.com) for the actual store.
  2. Install Google Analytics 4 on both and configure cross-domain tracking in GA4’s tag settings.
  3. Add the UTM capture-and-rewrite script (or a plugin that does it) to WordPress so links to Shopify carry original UTM data.
  4. If you need customer-level attribution that persists across sessions and connects to actual revenue, add a first-party attribution tool that integrates with both WordPress and Shopify.
  5. Connect Shopify’s Google and YouTube channel integration for GA4 purchase event tracking.

The goal is a setup where every Shopify sale you can trace back to the original channel that brought the customer in — not just the last click before they hit the Shopify checkout. That’s what lets you make real decisions about where to spend your marketing budget.

If you want help setting up cross-platform attribution between WordPress and Shopify, Sales Provenance is built for exactly this problem.