GA4 and Shopify sales don't match: why, and how to reconcile them
From the work/ 16 min read
Why GA4 shows fewer (or more) sales than Shopify, which gaps are normal and which are bugs, and a tested script that matches orders to purchases by transaction ID.
- Analytics
- Shopify
- CRO
In this article (9)
GA4 and Shopify don't match because they count different things: Shopify counts every order created in your store, whatever the channel, and GA4 only sees the purchases a shopper's browser sends it through the purchase event. Declined cookies, ad blockers, offsite payments, time zones and duplicate tags all widen the gap.
A steady gap is normal; GA4 above Shopify, or a sudden jump, is a tracking bug. Below: what each tool counts, where each sale drops out, what consent mode does and doesn't recover, how to stop duplicate purchase events, and a Node script that matches Shopify orders to GA4 purchases by transaction_id. If your ecommerce events aren't arriving at all yet, start with why the GA4 add_to_cart report is empty.
Why GA4 and Shopify don't match
Shopify spells it out on its analytics discrepancies page: each tool counts reloads, visitors and sessions its own way; Google can only count visitors with JavaScript and cookies turned on; some browser extensions block Google Analytics; and reports can use different time zones.
The underlying difference is where each number is born. A Shopify order exists in the admin no matter what happens in the shopper's browser: checkout, point of sale or a draft order creates it. A GA4 purchase exists only if a tag sent it from a browser, with its transaction_id, and GA4 has processed it. Whatever happens between those two points subtracts, and a few configuration mistakes add.
So compare orders to transactions, not sessions. Shopify changed how it measures sessions between September 21 and 23, 2026, per its session measurement update: a session now ends after 30 minutes of inactivity instead of at midnight UTC. Orders, sales and customer counts didn't change.
Scroll the figure sideways to see all of it
In the figure's illustrative week, GA4 sits 5 to 8 purchases below Shopify every day: those are the usual leaks. On Thursday GA4 goes above Shopify, and no leak can do that: a second tag is sending purchase. Watch the shape of the gap more than its size.
What each one counts
Put the two definitions side by side, as Shopify's docs (analytics fields, exporting orders and sales discrepancies) and Google's (events reference, dimensions and metrics and currency reference) describe them:
| Item | Shopify | GA4 |
|---|---|---|
| What it counts | Orders created in the store, from any channel. The export has a Source column with values such as web, draft order or POS. | purchase events that arrived from a browser or an app. The Transactions metric is the number of completed purchases. |
| Date | Created at: when the customer completed the order. | The day in the property's time zone, not the visitor's. |
| Amount | Net sales = gross sales − discounts − sales reversals. Total sales = net sales + fees + duties + shipping + taxes. | Whatever your tag sends in value. Google asks for the sum of price × quantity without shipping or tax, which go in shipping and tax. |
| Returns | Sales reports record them; the date range must cover the order and its return. | Purchase revenue subtracts the refunds it receives; Gross purchase revenue doesn't. |
| Currency | The export uses the store's base currency. | Converted to the property currency at the previous day's exchange rate. |
| Test orders | Not in sales reports; included in the export. | Counted if the tag fired. |
The amount deserves its own warning. Shopify's tutorial for running Google Tag Manager in a custom pixel sends checkout.totalPrice.amount as value, and the checkout_completed reference says that total includes duties, taxes and discounts, which isn't the basis Google recommends. Before you compare revenue, check in DebugView what your value holds and line it up with the matching Subtotal or Total column.
GA4's time zone and currency live in Admin, Property details, and per Google's setup help, changing the time zone only affects data going forward. Your store's time zone is under Settings > General.
The leaks: cookies, ad blockers and offsite payments
Leaks are real orders that never reach GA4. You won't close them completely, but each one leaves a different trace.
Sales outside the online store
Point-of-sale orders, draft orders and orders from other channels exist in Shopify without anyone loading the Thank you page. GA4 will never see them; filter them out with the Source column.
Cookies, consent and ad blockers
According to Shopify's pixels overview, in markets that require consent, such as the EEA and the UK, pixels run only with the permissions in their configuration. In your customer privacy settings, the default automation turns the cookie banner on for UK and EEA visitors if you sell there; it isn't active outside the configured regions by default, though you can enable it anywhere. Shopify warns that consent requirements lower the sessions and conversion rates it reports, and its discrepancies page adds that browser extensions can stop Google Analytics from tracking sessions and purchases. If you show a banner, make sure it doesn't shift your page: see how to fix CLS from a cookie banner.
Offsite payments and the Thank you page
On Shopify, the purchase is announced by the pixels' checkout_completed event. Per its reference, it fires once per checkout, typically on the Thank you page (or on the first page of a post-purchase offer), and doesn't fire at all if that page fails to load. When a payment method sends the shopper to the provider's page and they never come back to your store, the Thank you page never loads in their browser. You can spot those orders in the Payment Method column.
Old code on the Thank you page
If you tracked purchases with additional scripts or a script tag on the Order status page, check when GA4 started dropping. Per the checkout.liquid docs, additional scripts were sunset on the Thank you and Order status pages on August 28, 2025, and script tags on those pages on August 28, 2025 for Plus stores and August 26, 2026 for everyone else. Both dates have passed; pixels under Settings > Customer events replace them.
Scroll the figure sideways to see all of it
Consent mode: what it recovers and what it doesn't
Per Google's consent mode overview, in basic mode tags don't load until the visitor answers the banner, and if they decline, nothing is sent to Google. In advanced mode, tags load right away and, while consent is denied, send cookieless measurements.
GA4's behavioral modeling requires advanced consent mode on every page, plus:
- At least 1,000 events per day with
analytics_storage='denied'for at least 7 days. - At least 1,000 daily users with
analytics_storage='granted'on at least 7 of the previous 28 days. - The Blended reporting identity.
Even then, modeling estimates users, sessions and new users, not event counts. With it, unconsented events become reportable but aren't modeled, and without enough consented traffic they aren't reported at all. Consent mode doesn't rebuild your list of purchases: a purchase that never left the browser doesn't show up.
On Shopify, Google's Tag Manager help says turning on Shopify's cookie banner enables consent mode automatically, but it doesn't say whether that's basic or advanced. Test it: decline cookies and open the Pixel Helper; if your pixel says "awaiting consent", it didn't run. And when you test in DebugView, accept cookies: per its help page, DebugView doesn't show events from users who haven't consented to Analytics cookies.
How to prevent duplicate purchase events
GA4 handles part of it: per its transaction ID help, it deduplicates purchase events with the same transaction ID from the same user, and the ecommerce validation guide adds that it keeps the first one even if the second changes other values. That covers a reload of the Thank you page, not these cases:
- The same order with two IDs. If one tag sends
1003and another#1003, or one sends the order number and the other the internal ID, GA4 sees two purchases. - gtag.js and GTM together. The validation guide says to use one or the other; with both, some events are counted twice.
- An empty
transaction_id. GA4 deduplicates every purchase sent withtransaction_id="", so you lose sales instead of doubling them. - A hard-coded ID. Google warns that sending the same ID for different orders can significantly undercount purchases. The ID must be unique, dynamic and free of customer data.
Shopify documents one way to connect GA4: the Google & YouTube channel, which per its setup help tracks certain ecommerce events automatically. If someone also installed GA4 by hand, that's where duplicates come from. Look under Settings > Customer events, which lists the app pixels installed by apps and sales channels plus any custom pixels, and in the theme code. If two of them send purchase to the same property, keep one; Google's guide for the app asks for the same thing with Google Ads.
To test, place a test order with the test payment gateway or Shopify Payments test mode, which per the test orders help stays out of your reports, with the Pixel Helper and DebugView open: you should see exactly one purchase carrying transaction_id, value and currency. If DebugView doesn't list your device, use the Realtime report. Tag Assistant works for a tag pasted into the theme; Shopify warns that its Troubleshoot tag feature doesn't detect Google tags inside a custom pixel. The PDF guide has the steps.
How to compare them properly, order by order
Totals tell you there's a gap; matching IDs tells you what it is. Line up both sides first:
- Set GA4 and Shopify to the same time zone.
- Pick closed days at least 48 hours old: per the data freshness help, GA4 takes 24 to 48 hours to process and numbers change in the meantime.
- In Shopify, filter the orders for those dates, click Export and choose CSV.
- In GA4, create a blank exploration under Explore, import the Transaction ID dimension and the Transactions metric, drop them into rows and values, in that order, and export as CSV with Export data. Per the explorations help, the CSV holds all the data in the visualization.
- If the thresholding notice appears, widen the date range: the data thresholds help explains that GA4 can withhold rows to protect users.
Here's reconcile.mjs, with no dependencies. First, the CSV reader:
// reconcile.mjs: compares a Shopify orders export with a GA4 export of transaction IDs.
// Usage: node reconcile.mjs orders_export.csv ga4-transactions.csv
import { readFileSync } from "node:fs";
import { pathToFileURL } from "node:url";
// CSV with quoted fields: commas, "" and line breaks inside quotes.
export function parseCsv(text) {
const rows = [];
let row = [], field = "", quoted = false;
for (let i = 0; i < text.length; i++) {
const c = text[i];
if (quoted) {
if (c === '"' && text[i + 1] === '"') { field += '"'; i++; }
else if (c === '"') quoted = false;
else field += c;
} else if (c === '"') quoted = true;
else if (c === ",") { row.push(field); field = ""; }
else if (c === "\n") { row.push(field.replace(/\r$/, "")); rows.push(row); row = []; field = ""; }
else field += c;
}
if (field || row.length) { row.push(field.replace(/\r$/, "")); rows.push(row); }
return rows;
}
const clean = (id) => String(id ?? "").trim().replace(/^#/, "");
- The first two lines say what the script does and how to run it.
parseCsvwalks the text one character at a time. Inside quotes,""is a literal quote and commas or line breaks belong to the field, as in the product names of a Shopify export.- Outside quotes, a comma ends the field and a line break ends the row;
replace(/\r$/, "")drops the carriage return from Windows files. - The last row is kept even if the file doesn't end with a line break.
cleanturns the ID into a string, trims it and drops a leading#, so#1003and1003become the same key.
And the comparison:
export function reconcile(ordersCsv, ga4Csv) {
// Shopify: one row per line item, so keep the first row of each order (Name).
const [head, ...rows] = parseCsv(ordersCsv.replace(/^\uFEFF/, ""));
const col = Object.fromEntries(["Name", "Id", "Source", "Created at", "Payment Method"].map((n) => [n, head.indexOf(n)]));
const absent = Object.keys(col).filter((n) => col[n] < 0);
if (absent.length) throw new Error(`orders export without column(s): ${absent.join(", ")}`);
const orders = new Map();
const byId = new Map();
for (const r of rows) {
const name = r[col.Name];
if (!name || orders.has(name)) continue;
const order = { name, source: r[col.Source], created: r[col["Created at"]], payment: r[col["Payment Method"]], hits: [] };
orders.set(name, order);
// GA4 may hold the order number (1001 or #1001) or the order ID: index both.
for (const key of [clean(name), clean(r[col.Id])]) if (key) byId.set(key, order);
}
// GA4: skip blank lines and # comments before the header; then Transaction ID, Transactions.
const ga = parseCsv(ga4Csv.replace(/^\uFEFF/, "")).filter((r) => r.join("").trim());
const header = ga.findIndex((r) => !r[0].startsWith("#"));
const unknown = [];
for (const [id, count] of header < 0 ? [] : ga.slice(header + 1)) {
const n = Number(count);
if (!Number.isFinite(n)) throw new Error(`GA4 row "${id},${count}": the second column must be Transactions`);
const order = byId.get(clean(id));
if (order) order.hits.push({ id, n });
else unknown.push({ id, n });
}
const all = [...orders.values()];
return {
orders: all.length,
missing: all.filter((o) => o.hits.length === 0),
duplicated: all.filter((o) => o.hits.reduce((s, h) => s + h.n, 0) > 1),
unknown,
};
}
if (import.meta.url === pathToFileURL(process.argv[1]).href) {
const [ordersFile, gaFile] = process.argv.slice(2);
const r = reconcile(readFileSync(ordersFile, "utf8"), readFileSync(gaFile, "utf8"));
console.log(`Shopify orders: ${r.orders} · missing in GA4: ${r.missing.length} · duplicated: ${r.duplicated.length} · unknown IDs: ${r.unknown.length}`);
for (const o of r.missing) console.log(`MISSING ${o.name} source=${o.source} payment=${o.payment} created=${o.created}`);
for (const o of r.duplicated) console.log(`DUPLICATED ${o.name} ${o.hits.map((h) => `${JSON.stringify(h.id)}×${h.n}`).join(" + ")}`);
for (const u of r.unknown) console.log(`UNKNOWN ${JSON.stringify(u.id)}×${u.n}`);
}
- Shopify's export has one row per line item, repeating the
Name; the script keeps the first row of each order. - It finds the five columns by name and stops with an error if one is missing.
- It indexes each order by number (without
#) and byId, because you don't know which one your tag sends. It never indexes an empty key, so an emptytransaction_idcan't attach itself to an order. - In the GA4 file it skips blank lines and
#comments before the header, then requires the second column to be a number. - Each GA4 row is added to its order or, if it has none, to
unknown. - It returns the orders with no purchase (
missing) and the ones that add up to more than one (duplicated). - The
ifblock runs only from the terminal: it reads both CSVs and prints one line per finding, withSource,Payment MethodandCreated atfor the missing ones.
We tested it with sample CSVs written for the test: ten illustrative orders, one with two line items and with commas and quotes inside fields. All 8 tests passed under node --test, and four deliberately broken versions of the script failed. This is the real output:
$ node reconcile.mjs orders_export.csv ga4-transactions.csv
Shopify orders: 10 · missing in GA4: 4 · duplicated: 2 · unknown IDs: 3
MISSING #1004 source=web payment=offsite_gateway created=2026-11-09 14:22:40 -0600
MISSING #1005 source=pos payment=cash created=2026-11-09 15:01:09 -0600
MISSING #1007 source=shopify_draft_order payment=manual created=2026-11-09 17:45:00 -0600
MISSING #1008 source=web payment=shopify_payments created=2026-11-09 23:52:31 -0600
DUPLICATED #1003 "1003"×1 + "#1003"×1
DUPLICATED #1006 "1006"×2
UNKNOWN "(not set)"×1
UNKNOWN ""×1
UNKNOWN "1099"×1
- The summary: out of 10 orders, 4 are missing from GA4, 2 are duplicated and 3 IDs belong to no order.
#1004is a web order with an offsite payment: most likely the shopper never came back to the Thank you page.#1005(point of sale) and#1007(draft order) were never going to reach GA4.#1008was created at 11:52 p.m.: with a different time zone in GA4, it lands on the next day.#1003arrived with two ID formats and#1006arrived twice with the same one: double tags.(not set)is what GA4 shows when it received no value for the dimension; the empty ID is a purchase withouttransaction_id, and1099falls outside the export's date range, such as an order from another day.
Scroll the figure sideways to see all of it
The web orders still missing, with no offsite payment and nowhere near midnight, are the cookie and ad blocker leak: you won't recover them, but now you know their size. If your GA4 IDs look like neither the order number nor the Id column, they'll all come out as unknown: check in DebugView what your transaction_id holds.
Once the per-order gap is explained, compare by channel knowing they won't match there either: GA4 splits purchases with the model in its attribution settings, and changing it rewrites historical data too, while Shopify uses last click, per its customer and session discrepancies page.
Common mistakes
- Comparing sessions or conversion rates. Each tool defines them differently. Compare orders to transactions.
- Counting export rows. An order with three line items takes three rows; count orders by
Name. - Comparing yesterday. GA4 can take up to 48 hours to close out a day.
- Total sales vs. purchase revenue. One adds shipping and taxes and subtracts returns; the other is your
valueminus the refunds it receives. - Papering over the gap with another tag. It won't recover what cookies or ad blockers stop; it only doubles what already arrives.
Frequently asked questions
How big a gap between GA4 and Shopify is normal?
Neither Google nor Shopify publishes a percentage: it depends on your channels, payment methods, banner regions and audience. The signal is change: a steady gap is your baseline, and a sudden jump or GA4 above Shopify is a bug to hunt down.
Does consent mode recover the sales I can't see?
Not the list of purchases. Modeling estimates users and sessions, not events, and only for eligible properties. An event that was never sent, because of an ad blocker or a pixel waiting for consent, doesn't appear.
Why does GA4 show more sales than Shopify?
Almost always a second tag sending the same order with another ID format; the script lists those under DUPLICATED. In revenue, it also happens when Shopify subtracts a cancellation or a return and GA4 never got the refund.
Which number should I use for my books?
Shopify's, where orders, payments and returns live. GA4 is for understanding where shoppers come from and what they do in your store, and a steady gap doesn't get in the way of that.
Checklist
- GA4 and the store use the same time zone.
- You compare orders to transactions for closed days more than 48 hours old.
- POS, draft orders and other channels are filtered out with the
Sourcecolumn. - You know what basis your
valueuses and compare it with the matching Shopify column. - Only one tag sends
purchaseto each property, checked in Customer events and in the theme. transaction_idis the order ID, never empty or hard-coded.- A test order leaves exactly one
purchasein DebugView. - You rerun the order-by-order match after every change to tags, apps or the theme.
Once the gap is steady and you know where it comes from, put it to work: if GA4 suddenly drops, check your tracking; if Shopify orders drop, check your checkout. For the second case, set up checkout conversion alerts, and if your events break before the purchase, review the GA4 add_to_cart event.
Saw this on Instagram? Comment TRACKING on the Reel and I'll send you the guide.
Written by

Published November 11, 2026