Skip to main content
Magento → BigQueryIntegration guide

Connecting Magento to BigQuery

Magento is self-hosted and endlessly customisable, which means every installation is different and full-page caching is always in the way. BigQuery has no attribution model, no deduplication rules and no opinion about your data — which makes it the only destination on this site where every number is exactly as good as the query that produced it. The join between them succeeds or fails on one thing: whether whatever join key you decide on reaches the Magento order before the conversion happens, because BigQuery can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Magento to BigQuery: load sales_order with the click IDs on it

Load Magento's sales_order, sales_order_item and sales_creditmemo tables into BigQuery, plus click identifiers and consent captured at landing onto the quote and copied to the order. Store both increment_id and entity_id, keying on store_id plus increment_id on multi-store installs. Load every order status with timestamps and define revenue as a query, not an export setting.

Magento already holds the truth in its own database, so the BigQuery job is a faithful copy plus the columns Magento lacks: click identifiers and consent captured at landing. Add those to the quote, copy them onto the order at placement, and they arrive in the warehouse on the same row as the grand total. Load sales_order, sales_order_item and sales_creditmemo, not a reporting export, so refunds and partial refunds stay recoverable.

Pick the join key deliberately. increment_id is what customers and support see and what you should send to ad platforms; entity_id is what Magento's own tables reference. Store both. On multi-store installs increment_id can repeat across store views depending on configuration, so key on store_id plus increment_id until you have checked yours.

The quiet divergence is order status. A load filtered to complete orders will disagree with ad platforms that received a conversion at placement, while processing orders later cancelled will disagree the other way. Load every status with its timestamp, and define revenue as a query, not as an export setting someone changes without telling anyone.

Magento → BigQuery · what breaks

Why this join usually fails — Magento → BigQuery

  1. 01

    Whatever join key you decide on never reaches Magento

    Magento's full-page cache serves a stored render to the visitor, which means anything relying on dynamically rendered values can silently fail — and in Magento this has historically included serving one customer's cached block to another, which is a data problem as well as a tracking one.

  2. 02

    Full-page cache between the visitor and your code

    The page the customer saw is not the page your code assumed. This is the defining Magento tracking failure and it produces intermittent, hard-to-reproduce loss.

  3. 03

    The warehouse quietly disagreeing with every platform

    This is not a bug — it is the point. Your warehouse counts orders; Google counts click-attributed conversions in its window; Meta counts differently again. When the four numbers differ, the warehouse is usually right about revenue and wrong about attribution, and knowing which question you are answering is the whole skill.

  4. 04

    Nothing reconciles afterwards

    BigQuery will not tell you anything is wrong. Verify by querying the table directly against your source system's own totals, and check for duplicate rows on the join key before trusting any aggregate.

Magento → BigQuery · the fix

What working looks like — Magento → BigQuery

  • Whatever join key you decide on on every order

  • Conversions arriving in BigQuery

    The row lands in a table you own, joinable to every other table you own, with no window and no expiry.

  • Reconciled against the source

Magento → BigQuery · architecture

How Magento and BigQuery actually connect

  1. 1

    Magento holds the truth

    You own the database, so the truth is as good as the query. Pin down which order statuses count as revenue — processing, complete, or both — because that choice moves the number substantially.

  2. 2

    BigQuery needs a click to match

    BigQuery needs a schema and consistent types. The failure mode is not rejection, it is silent divergence: a column that arrives as a string in one load and an integer in the next, or a timestamp in the wrong zone, which produces answers that look plausible and are not.

  3. 3

    The identifier is the bridge

    Whatever join key you decide on, captured at the visit and carried into the Magento order.

  4. 4

    The event source decides reliability

    Fire server-side from the observer rather than from the success page template, which is cached and may not execute anything.

  5. 5

    Deduplication at the destination

    Nothing deduplicates for you. Streaming inserts are at-least-once, so a retried load can create duplicate rows, and the only protection is a deduplication step you write and actually run.

Magento → BigQuery · normal or broken

Working vs. broken, side by side — Magento → BigQuery

Normal, not a fault

  • Whatever join key you decide on present on the order

  • Sent from the Magento order placement observer

  • Deduplicated correctly

    Nothing deduplicates for you. Streaming inserts are at-least-once, so a retried load can create duplicate rows, and the only protection is a deduplication step you write and actually run.

  • Reconciles with the source

Actually broken

  • Whatever join key you decide on missing on most records

    Magento's full-page cache serves a stored render to the visitor, which means anything relying on dynamically rendered values can silently fail — and in Magento this has historically included serving one customer's cached block to another, which is a data problem as well as a tracking one.

  • Sent from the browser

    The page the customer saw is not the page your code assumed. This is the defining Magento tracking failure and it produces intermittent, hard-to-reproduce loss.

  • Counted twice, or not at all

    This is not a bug — it is the point. Your warehouse counts orders; Google counts click-attributed conversions in its window; Meta counts differently again. When the four numbers differ, the warehouse is usually right about revenue and wrong about attribution, and knowing which question you are answering is the whole skill.

  • Nobody has reconciled it

Magento → BigQuery · diagnose

Diagnostic order — Magento → BigQuery

  1. 01

    Count orders carrying whatever join key you decide on

  2. 02

    Follow one real conversion end to end

  3. 03

    Place a test order as an anonymous visitor through cache

    Not as an admin, which bypasses it. If the order data is missing on the cached path, caching is your cause.

  4. 04

    Reconcile warehouse order counts against each platform for one closed window

    The gaps localize the problem: a gap against all platforms is a collection issue, a gap against one is that platform's window or matching.

  5. 05

    Read the match rate, not the success message

    BigQuery will not tell you anything is wrong. Verify by querying the table directly against your source system's own totals, and check for duplicate rows on the join key before trusting any aggregate.

Magento → BigQuery · prove

How it gets proven — Magento → BigQuery

Source of truth

Magento's sales order records in your own database, for the same window and order status set.

  • Whatever join key you decide on confirmed present on a live order.
  • Warehouse order counts and revenue reconciled against the source system for a fully closed window, with duplicates checked on the join key.
  • Order data confirmed populated on an order placed through a fully warmed cache.

Magento → BigQuery · free audit

What we check in the free audit

  • Count orders carrying whatever join key you decide on
  • Follow one real conversion end to end
  • Place a test order as an anonymous visitor through cache
  • Reconcile warehouse order counts against each platform for one closed window
  • Read the match rate, not the success message

Checked against

Magento's sales order records in your own database, for the same window and order status set.

Get my free conversion tracking audit

Free30 minutesNo obligation

Magento → BigQuery · when not to buy

When you don't need this — Magento → BigQuery

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry whatever join key you decide on.
  • If your Magento build has heavy customisation by another team, scope their availability first — the build is usually blocked there.
  • If you have one store and one ad platform, a warehouse is infrastructure you will maintain for a reconciliation you could do in a spreadsheet.

Magento → BigQuery · what we deliver

What gets built — Magento → BigQuery

  • Identifier capture into Magento

    Capture the identifier and persist it as order data through an observer on order placement, server-side, so it never depends on what the cache served.

  • Event source: the Magento order placement observer

    Fire server-side from the observer rather than from the success page template, which is cached and may not execute anything.

  • Dispatch to BigQuery

    Streaming inserts or scheduled batch loads from your order system, with the raw event retained alongside whatever you derive from it.

  • Reversals where they exist

    Credit memos are recorded against the original order and should reduce the reported figure.

Written guarantee

95%+ tracking accuracy

Measured against Magento's sales order records in your own database, for the same window and order status set.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Magento → BigQuery questions, answered

Replicate the order, item and credit memo tables from Magento's database on a schedule, with click identifier columns added to the order. Confirm types and time zones before the first load.

Free · 30 min

Get Magento and BigQuery joined properly

Free30 minutesNo obligation