# Reconcile Shopify Purchases Before You Trust a Conversion Count

*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

```python
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](https://readme.anytrack.io/docs/getting-started) 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](https://stackbenchjournal.wordpress.com/2026/11/28/anytrack-shopify-attribution-audit/).
