Skip to main content
AfterSell → GA4Integration guide

Connecting AfterSell to GA4

AfterSell works through checkout extensions and post-purchase pages, which puts its offers inside Shopify's sandboxed surfaces where your own scripts cannot reach. GA4 is where the business goes to understand what happened, which makes an unattributed conversion there expensive in decisions rather than in ad spend. The join between them succeeds or fails on one thing: whether the GA4 client_id reaches the AfterSell upsell order before the conversion happens, because GA4 can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

AfterSell to GA4: post-purchase upsells in purchase revenue

Shopify's checkout_completed fires on AfterSell's first offer page, so browser purchases miss accepted upsells. Send GA4's purchase from the order webhook through Measurement Protocol once the post-purchase step settles, with the full items array, upsell lines marked, and the client_id and session_id saved in a cart attribute. Switch off the browser purchase.

With AfterSell's post-purchase page in the flow, Shopify fires its checkout_completed pixel event on the first upsell offer page, not on the thank-you page. Whatever sends GA4's purchase from that event, whether the Google & YouTube app or your own custom pixel, reports the order before the customer has seen the offer, so accepted upsells never reach GA4 revenue or item reports.

The fix is to send purchase from the Shopify order webhook through Measurement Protocol once the post-purchase step has settled, with the full items array and the upsell lines marked (an item_list_name or a custom parameter of your own works). That needs the _ga client_id and session_id written to a cart attribute on the storefront, because nothing inside checkout or the AfterSell extension can read them for you. Then switch off the browser-side purchase, or GA4 ends up holding two purchases for one order with two different values.

Keep in-checkout AfterSell offers separate from post-purchase ones when you compare numbers: offers accepted inside checkout are already in the checkout total, so only the post-purchase acceptances are missing today. For a returned upsell, send GA4's refund event with the transaction_id and only that item, so take rate and refund rate can both be read per product.

AfterSell → GA4 · what breaks

Why this join usually fails — AfterSell → GA4

  1. 01

    The GA4 client_id never reaches AfterSell

    Extension surfaces are isolated by design. Attempting to instrument them client-side does not work and is not supported.

  2. 02

    Trying to instrument a sandbox

    Time gets spent attempting to observe checkout extension behaviour from the storefront. It cannot be done, by design, and every hour spent on it is an hour not spent on the server-side path that works.

  3. 03

    Everything lands under (direct)/(none)

    The classic Measurement Protocol symptom, and it always means the same thing: the client_id was missing or wrong, so GA4 had no session to attach the event to and invented a new user.

  4. 04

    Nothing reconciles afterwards

    GA4 DebugView shows events arriving with their parameters, and Realtime confirms the user and session they attached to. Neither tells you whether you are double-counting — for that, compare GA4's conversion count against the source system's record for the same window.

AfterSell → GA4 · the fix

What working looks like — AfterSell → GA4

  • The GA4 client_id on every order

  • Conversions arriving in GA4

    Conversions appear in GA4 attributed to the original session's source and medium, so acquisition reporting reflects what actually drove revenue.

  • Reconciled against the source

AfterSell → GA4 · architecture

How AfterSell and GA4 actually connect

  1. 1

    AfterSell holds the truth

    Checkout UI extensions run sandboxed. Nothing you write can observe them, so the only reliable view of what the customer accepted is the order itself.

  2. 2

    GA4 needs a click to match

    GA4 needs the client_id to attach a server event to the user and session that produced the click. Without it there is no attribution to inherit and the event is orphaned.

  3. 3

    The identifier is the bridge

    The GA4 client_id, captured at the visit and carried into the AfterSell upsell order.

  4. 4

    The event source decides reliability

    Send the final order total from the webhook, with upsell line items identified.

  5. 5

    Deduplication at the destination

    GA4 has no built-in deduplication for Measurement Protocol. If the browser also sends the event, it counts twice. The only reliable approach is to decide per event which side sends it, and enforce that decision — GA4 will not protect you from your own duplicates.

AfterSell → GA4 · normal or broken

Working vs. broken, side by side — AfterSell → GA4

Normal, not a fault

  • The GA4 client_id present on the order

  • Sent from the Shopify order webhook

  • Deduplicated correctly

    GA4 has no built-in deduplication for Measurement Protocol. If the browser also sends the event, it counts twice. The only reliable approach is to decide per event which side sends it, and enforce that decision — GA4 will not protect you from your own duplicates.

  • Reconciles with the source

Actually broken

  • The GA4 client_id missing on most records

    Extension surfaces are isolated by design. Attempting to instrument them client-side does not work and is not supported.

  • Sent from the browser

    Time gets spent attempting to observe checkout extension behaviour from the storefront. It cannot be done, by design, and every hour spent on it is an hour not spent on the server-side path that works.

  • Counted twice, or not at all

    The classic Measurement Protocol symptom, and it always means the same thing: the client_id was missing or wrong, so GA4 had no session to attach the event to and invented a new user.

  • Nobody has reconciled it

AfterSell → GA4 · diagnose

Diagnostic order — AfterSell → GA4

  1. 01

    Count orders carrying the GA4 client_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Confirm the conversion is sourced from the order, not from a page

    On modern Shopify checkout there is no supported page-based option left, so this is the only correct architecture.

  4. 04

    Check whether server events carry a session and a source

    In GA4 Realtime or DebugView, find the event and look at its session and traffic source. A brand-new user with no source on every server event is the missing-client_id signature.

  5. 05

    Read the match rate, not the success message

    GA4 DebugView shows events arriving with their parameters, and Realtime confirms the user and session they attached to. Neither tells you whether you are double-counting — for that, compare GA4's conversion count against the source system's record for the same window.

AfterSell → GA4 · prove

How it gets proven — AfterSell → GA4

Source of truth

The final Shopify order total, read from the order record.

  • The GA4 client_id confirmed present on a live order.
  • Server events confirmed in DebugView attaching to an existing session with the original traffic source intact.
  • Final order totals reconciled from the webhook against imported conversions.

AfterSell → GA4 · free audit

What we check in the free audit

  • Count orders carrying the GA4 client_id
  • Follow one real conversion end to end
  • Confirm the conversion is sourced from the order, not from a page
  • Check whether server events carry a session and a source
  • Read the match rate, not the success message

Checked against

The final Shopify order total, read from the order record.

Get my free conversion tracking audit

Free30 minutesNo obligation

AfterSell → GA4 · when not to buy

When you don't need this — AfterSell → GA4

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the GA4 client_id.
  • If your conversions already come from the order webhook, checkout extensions change nothing for you.
  • GA4 is reporting, not bidding. If your problem is ad platform optimization, fix the ad platform destination first — GA4 will not change what any campaign does.

AfterSell → GA4 · what we deliver

What gets built — AfterSell → GA4

  • Identifier capture into AfterSell

    Do not try to instrument the checkout surface. Read the order server-side, which is the supported and more reliable path anyway.

  • Event source: the Shopify order webhook

    Send the final order total from the webhook, with upsell line items identified.

  • Dispatch to GA4

    Measurement Protocol events with the client_id, session_id and the correct measurement ID and API secret, sent server-side.

  • Reversals where they exist

    Refunds reverse.

Written guarantee

95%+ tracking accuracy

Measured against The final Shopify order total, read from the order record.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

AfterSell → GA4 questions, answered

GA4's purchase is usually sent from checkout_completed, which fires on the first post-purchase offer page, before the upsell is accepted. Sending purchase from the order webhook instead closes the gap.

Free · 30 min

Get AfterSell and GA4 joined properly

Free30 minutesNo obligation