Skip to main content
Drupal Commerce → BigQueryIntegration guide

Connecting Drupal Commerce to BigQuery

Drupal Commerce is self-hosted commerce inside a CMS built for complex content, which means the store is one part of a much larger site you fully control. 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 Drupal 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

Drupal Commerce to BigQuery: your order tables, made comparable

Replicate commerce_order and commerce_order_item into BigQuery on a schedule, including price number and currency columns, click-ID fields, order_id and store_id. Append workflow state and changed timestamp for history, define revenue in one view naming counted states, load from the database or a queue rather than admin Views exports, and check duplicate order_ids.

Of all the destinations, this one suits Drupal Commerce best: you already own the database, and BigQuery makes it queryable next to ad spend. Replicate commerce_order and commerce_order_item on a schedule, including the price columns (Drupal stores a number and a currency_code per price field) and the order field where you keep click identifiers. Key everything on order_id and keep store_id, because one Drupal install can run several stores that nobody should add together.

The workflow-state problem becomes a column instead of an argument. Load the state and the changed timestamp, append each load rather than overwriting so you keep history, and define revenue in a single BigQuery view that names the states it counts. Finance, marketing and whoever built the Drupal site are then at least disagreeing about the same written definition.

Load from the database, or from a queue fed by order event subscribers, not from Drupal Views exports built for admins; those inherit permissions, pagination and language filters that silently drop rows. Check for duplicate order_id rows after every load. With gclid, fbclid and ttclid stored per order, this table becomes the source for offline conversion uploads later, and it lets you test Drupal's cache problem directly: orders whose click-ID field is empty, grouped by landing language or domain, show exactly where capture code is not running.

Drupal Commerce → BigQuery · what breaks

Why this join usually fails — Drupal Commerce → BigQuery

  1. 01

    Whatever join key you decide on never reaches Drupal Commerce

    Drupal's internal page cache and any reverse proxy in front of it serve stored renders, so anything relying on dynamically rendered values fails intermittently. Multilingual and multi-site installs add further paths where the capture code may simply not run.

  2. 02

    Configurable workflow states nobody agreed on

    Drupal Commerce lets each install define its own order states. Two people reporting on the same store routinely count different states and never reconcile.

  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.

Drupal Commerce → BigQuery · the fix

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

Drupal Commerce → BigQuery · architecture

How Drupal Commerce and BigQuery actually connect

  1. 1

    Drupal Commerce holds the truth

    You own the database, so the truth is exactly as good as the query. Pin down which order states count as revenue before comparing anything — Drupal's workflow states are configurable per install, so no two sites agree by default.

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

  4. 4

    The event source decides reliability

    Fire server-side from the hook rather than the checkout completion template, which is cacheable 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.

Drupal Commerce → BigQuery · normal or broken

Working vs. broken, side by side — Drupal Commerce → BigQuery

Normal, not a fault

  • Whatever join key you decide on present on the order

  • Sent from the Drupal Commerce order placement hook

  • 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

    Drupal's internal page cache and any reverse proxy in front of it serve stored renders, so anything relying on dynamically rendered values fails intermittently. Multilingual and multi-site installs add further paths where the capture code may simply not run.

  • Sent from the browser

    Drupal Commerce lets each install define its own order states. Two people reporting on the same store routinely count different states and never reconcile.

  • 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

Drupal Commerce → BigQuery · diagnose

Diagnostic order — Drupal Commerce → BigQuery

  1. 01

    Count orders carrying whatever join key you decide on

  2. 02

    Follow one real conversion end to end

  3. 03

    List the order states in use and agree which count as revenue

    Do this before any technical work — it resolves more Drupal Commerce disputes than any code change.

  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.

Drupal Commerce → BigQuery · prove

How it gets proven — Drupal Commerce → BigQuery

Source of truth

Drupal's commerce_order records in your own database, filtered to completed states.

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

Drupal Commerce → 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
  • List the order states in use and agree which count as revenue
  • Reconcile warehouse order counts against each platform for one closed window
  • Read the match rate, not the success message

Checked against

Drupal's commerce_order records in your own database, filtered to completed states.

Get my free conversion tracking audit

Free30 minutesNo obligation

Drupal Commerce → BigQuery · when not to buy

When you don't need this — Drupal Commerce → BigQuery

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry whatever join key you decide on.
  • If your Drupal site is content-only with commerce elsewhere, work at the commerce system instead — this is the wrong layer.
  • 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.

Drupal Commerce → BigQuery · what we deliver

What gets built — Drupal Commerce → BigQuery

  • Identifier capture into Drupal Commerce

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

  • Event source: the Drupal Commerce order placement hook

    Fire server-side from the hook rather than the checkout completion template, which is cacheable 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

    Order state transitions to refunded or cancelled are recorded and can drive reversals.

Written guarantee

95%+ tracking accuracy

Measured against Drupal's commerce_order records in your own database, filtered to completed states.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Drupal Commerce → BigQuery questions, answered

order_id for orders and line items, and the click identifier stored on the order for joining to ad clicks. Avoid joining on email alone; guest checkouts reuse and mistype it.

Free · 30 min

Get Drupal Commerce and BigQuery joined properly

Free30 minutesNo obligation