Skip to main content
Craft → BigQueryIntegration guide

Connecting Craft CMS to BigQuery

Craft is a developer-oriented CMS, usually built bespoke by an agency, which means the implementation is whatever that agency decided and nothing is standard. 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 Craft Commerce 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

Craft Commerce to BigQuery: extracting orders from a bespoke schema

Load Craft Commerce completed orders into BigQuery keyed on order reference, line items on their own ID, and transactions separately, since refunds arrive as transaction rows. Read custom-field click IDs from wherever your Craft version stores them, JSON in Craft 5, and keep them as raw columns. Keep the site or store ID on multi-store installs.

BigQuery is where Craft's bespoke nature costs you directly, because you are reading this build's data model rather than an integration's. Commerce keeps orders, line items and transactions in its own tables, but the click IDs and source fields your agency added live in custom fields, and where those sit depends on the Craft version: Craft 5 stores custom field values as JSON per element and site, while older versions spread them across content-table columns. Check which before writing the extract.

Load completed orders keyed on the order reference, line items on their own ID, and Commerce transactions separately, because refunds arrive as transaction rows against the order rather than as a change to the order total. Keep any stored gclid, fbclid, rdt_cid or other click IDs as raw columns beside the order. That is what lets you later send the same order to any ad platform, or check a platform's count against the warehouse.

Prefer a scheduled read of the database or rows pushed from a Commerce event listener over control-panel CSV exports. The common break is a multi-site or multi-store Craft install where several storefronts share the tables and the site or store ID is dropped in the load, so revenue can't be split by storefront or currency afterwards.

Craft → BigQuery · what breaks

Why this join usually fails — Craft → BigQuery

  1. 01

    Whatever join key you decide on never reaches Craft

    Craft's template caching and static caching plugins both serve stored output, and because every build is custom, where the capture code lives differs per site. There is no standard place to look.

  2. 02

    Every install is bespoke

    There is no standard Craft setup, so an approach that worked on another Craft site may have nothing to attach to on this one. Read the build before quoting.

  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.

Craft → BigQuery · the fix

What working looks like — Craft → 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

    Craft CMS's own records are the reference, not either dashboard.

Craft → BigQuery · architecture

How Craft and BigQuery actually connect

  1. 1

    Craft CMS holds the truth

    Craft installs are bespoke by nature. Establish how this particular build models a completed order before assuming anything transfers from another Craft site.

  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 Craft Commerce order.

  4. 4

    The event source decides reliability

    Fire from the event listener in PHP rather than a Twig template, which may be cached.

  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.

Craft → BigQuery · normal or broken

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

Normal, not a fault

  • Whatever join key you decide on present on the order

    Visible on the record itself in Craft CMS, not merely captured somewhere on the site.

  • Sent from the Craft Commerce order-complete event

  • 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

    BigQuery's count and Craft CMS's records agree within a few percent over a closed window.

Actually broken

  • Whatever join key you decide on missing on most records

    Craft's template caching and static caching plugins both serve stored output, and because every build is custom, where the capture code lives differs per site. There is no standard place to look.

  • Sent from the browser

    There is no standard Craft setup, so an approach that worked on another Craft site may have nothing to attach to on this one. Read the build before quoting.

  • 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

    The dashboard shows a number and no one has compared it to Craft CMS.

Craft → BigQuery · diagnose

Diagnostic order — Craft → BigQuery

  1. 01

    Count orders carrying whatever join key you decide on

  2. 02

    Follow one real conversion end to end

  3. 03

    Read how this specific build handles order completion

    Assumptions carried from another Craft project are the main source of wasted time here.

  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.

Craft → BigQuery · prove

How it gets proven — Craft → BigQuery

Against Craft CMS's own records, not against either platform's dashboard.

Source of truth

Craft Commerce's order records in your own database, filtered to completed.

  • 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 custom field confirmed populated on an order placed as an anonymous visitor through cache.

Craft → 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
  • Read how this specific build handles order completion
  • Reconcile warehouse order counts against each platform for one closed window
  • Read the match rate, not the success message

Checked against

Craft Commerce's order records in your own database, filtered to completed.

Get my free conversion tracking audit

Free30 minutesNo obligation

Craft → BigQuery · when not to buy

When you don't need this — Craft → BigQuery

  • If BigQuery already reports conversions that reconcile against Craft CMS's records within a few percent, this join is working and there is nothing to buy.
  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry whatever join key you decide on.
  • If the original agency is still engaged, the fastest path is usually specifying the field and having them add the hook.
  • 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.

Craft → BigQuery · what we deliver

What gets built — Craft → BigQuery

  • Identifier capture into Craft

    Capture the identifier and store it as a custom field on the order through a Craft event listener, server-side.

  • Event source: the Craft Commerce order-complete event

    Fire from the event listener in PHP rather than a Twig template, which may be cached.

  • 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

    Refunds and cancelled orders are recorded against the order.

Written guarantee

95%+ tracking accuracy

Measured against Craft Commerce's order records in your own database, filtered to completed.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Craft → BigQuery questions, answered

Not natively. Most builds either replicate the MySQL or Postgres database on a schedule or push rows from a Commerce event listener; confirm which fits your hosting before choosing.

Free · 30 min

Get Craft and BigQuery joined properly

Free30 minutesNo obligation