Skip to main content

Reconcile Shopify Purchases Before You Trust a Conversion Count

Updated 3 min readMarkdown

A small Python audit for missing, duplicated, and mismatched purchase events.

A paid order and a purchase event can carry the same value and still mean different things. If the tracking route emits two purchase events for one Shopify order, a campaign report can look healthier without the store taking another payment. Reconcile the records at order level before opening the campaign report.

This article was drafted with AI assistance. The inputs are fictional. The companion guide on my site contains an affiliate link that may earn me a commission.

Choose a key before counting

Use the store and order ID as the join key. Compare one destination, one purchase event type, and one reporting window at a time. The same order appearing once in Meta and once in Google is expected if you’ve configured both destinations. Two arrivals in the same destination are worth inspecting for overlapping routes or retries. Receiving two events does not by itself prove the platform counted two conversions.

Normalize values to minor currency units and agree on whether taxes, shipping, and discounts belong in the event value. Keep only the fields required for the audit. Names, emails, and IP addresses are unnecessary for the reconciliation below.

Audit an export locally

from collections import defaultdict

def audit(orders, destination_events):
    orders_by_key = {}
    for store, order_id, minor, currency in orders:
        key = store, order_id
        if key in orders_by_key:
            raise ValueError(f"ambiguous order key: {key}")
        orders_by_key[key] = minor, currency

    arriving = defaultdict(list)
    for store, order_id, minor, currency in destination_events:
        arriving[store, order_id].append((minor, currency))

    for key in sorted(orders_by_key.keys() | arriving.keys()):
        expected = orders_by_key.get(key)
        observed = arriving.get(key, [])
        if expected is None:
            yield key, "no matching order"
        elif not observed:
            yield key, "missing event"
        else:
            if len(observed) > 1:
                yield key, "multiple arrivals"
            if any(event != expected for event in observed):
                yield key, "value or currency mismatch"

orders = [("shop", "1001", 8400, "USD"), ("shop", "1002", 5200, "USD")]
events = [("shop", "1001", 8400, "USD"), ("shop", "1001", 8400, "USD")]
assert list(audit(orders, events)) == [
    (("shop", "1001"), "multiple arrivals"),
    (("shop", "1002"), "missing event"),
]

Check the missing hop

If the order exists and the tracking tool never received the event, start at the integration. If the tracking tool received it and a destination has no record, check event mapping, forwarding, and reporting lag. Compare platform-attributed revenue only after you understand what was delivered. Attribution windows, campaign rules, and a missing consented match can all explain why a delivered event gets no campaign credit.

AnyTrack’s verification guide walks through checking the tag, receiving a test conversion, and inspecting campaign attribution in that order. If you’re migrating senders, verify a controlled test before changing production and compare the same event at each hop.

For the full one-order walkthrough, see the AnyTrack Shopify attribution audit on Stack Bench Journal.

1 view

About the author

  • I’m Pratham Malhotra, founder of SaaSFolio (saasfolio.tech), where I track SaaS pricing and deals. Here I publish hands-on guides to SaaS analytics, developer tools and web hosting, with runnable code, real costs and honest trade-offs. Some posts contain affiliate links, and I always disclose them.

The "same value, different meaning" point is so underrated. That's the same reason postbacks in ArtisanClo (I work on it) tie every conversion back to the exact click that started it, so ROI by source and GEO is counted from the network's own postback rather than from whatever the browser happened to fire. Nice to see a reconciliation script anyone can run though, more people should audit before trusting a dashboard. If you ever want to compare against a server-side source of truth, artisanclo.com has a 7-day free trial.