Skip to main content
Salesforce → BigQueryIntegration guide

Connecting Salesforce to BigQuery

Salesforce holds the opportunity, the amount and the close — the only place the actual revenue outcome is recorded. 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 Salesforce Lead or Opportunity 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

Salesforce to BigQuery: Leads, conversions and stage history

Load Salesforce Lead, Contact, Account, Opportunity and OpportunityHistory into BigQuery, plus field history for click-ID fields, incrementally on SystemModstamp. Join on Lead.ConvertedOpportunityId to recover gclid, fbclid or rdt_cid from the original Lead when conversion mapping failed. Store CurrencyIsoCode with amounts, then build offline conversion uploads for any ad platform from these tables.

BigQuery is where Salesforce attribution can actually be audited, because it can hold what Salesforce reports overwrite: every stage change, every amount change and the original Lead. Load Lead, Contact, Account, Opportunity and OpportunityHistory, plus field history for your click-ID custom fields if it is enabled. Check whether BigQuery's Data Transfer Service or a connector you already pay for covers Salesforce before building a loader.

The join that makes attribution possible is Lead.ConvertedOpportunityId: it connects the Lead that captured gclid, fbclid or rdt_cid to the Opportunity that later closed. If the click-ID field mapping through conversion was ever missing, this join recovers the identifier from the original Lead, which is the one thing the warehouse can fix that Salesforce cannot.

Store CurrencyIsoCode with every amount in multi-currency orgs, and convert at the rate your finance team uses, not at load time. Load incrementally on SystemModstamp and deduplicate on record ID, keeping the latest version for state and OpportunityHistory for timing. From this you can build offline conversion uploads for any ad platform on your own rules, instead of relying on each platform's Salesforce connector.

Salesforce → BigQuery · what breaks

Why this join usually fails — Salesforce → BigQuery

  1. 01

    Whatever join key you decide on never reaches Salesforce

    Lead conversion is where identifiers die. A custom field on Lead that has no mapped counterpart on Contact or Opportunity is silently discarded when the Lead converts, and nobody notices until months of data are unattributable.

  2. 02

    The identifier is lost at lead conversion

    This one failure explains most broken Salesforce attribution. The data is captured correctly, then thrown away by a mapping nobody configured.

  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.

Salesforce → BigQuery · the fix

What working looks like — Salesforce → BigQuery

  • Whatever join key you decide on on every opportunity

  • 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

Salesforce → BigQuery · architecture

How Salesforce and BigQuery actually connect

  1. 1

    Salesforce holds the truth

    The opportunity carries the amount, stage and close date. Because Leads convert into Contacts, Accounts and Opportunities, the identifier must be mapped through the conversion or it is dropped exactly at the moment the record becomes valuable.

  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 Salesforce Lead or Opportunity.

  4. 4

    The event source decides reliability

    Fire on the transition into Closed Won, carrying the amount and the identifier. Note that Salesforce's own advertising integrations vary in what they support — build on the record, not on a connector that might change.

  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.

Salesforce → BigQuery · normal or broken

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

Normal, not a fault

  • Whatever join key you decide on present on the opportunity

  • Sent from a Salesforce flow, Apex trigger or scheduled export on StageName change

  • 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

    Lead conversion is where identifiers die. A custom field on Lead that has no mapped counterpart on Contact or Opportunity is silently discarded when the Lead converts, and nobody notices until months of data are unattributable.

  • Sent from the browser

    This one failure explains most broken Salesforce attribution. The data is captured correctly, then thrown away by a mapping nobody configured.

  • 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

Salesforce → BigQuery · diagnose

Diagnostic order — Salesforce → BigQuery

  1. 01

    Count opportunitys carrying whatever join key you decide on

  2. 02

    Follow one real conversion end to end

  3. 03

    Convert a test Lead and inspect the resulting Opportunity

    If the identifier is not on the Opportunity, the field mapping is missing. This takes five minutes and rules out the most likely cause outright.

  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.

Salesforce → BigQuery · prove

How it gets proven — Salesforce → BigQuery

Source of truth

A Salesforce report of Closed Won opportunities for the same window, by close date.

  • Whatever join key you decide on confirmed present on a live opportunity.
  • Warehouse order counts and revenue reconciled against the source system for a fully closed window, with duplicates checked on the join key.
  • A test lead converted end to end with the identifier confirmed present on the resulting opportunity.

Salesforce → BigQuery · free audit

What we check in the free audit

  • Count opportunitys carrying whatever join key you decide on
  • Follow one real conversion end to end
  • Convert a test Lead and inspect the resulting Opportunity
  • Reconcile warehouse order counts against each platform for one closed window
  • Read the match rate, not the success message

Checked against

A Salesforce report of Closed Won opportunities for the same window, by close date.

Get my free conversion tracking audit

Free30 minutesNo obligation

Salesforce → BigQuery · when not to buy

When you don't need this — Salesforce → BigQuery

  • Measure identifier coverage yourself first — pull your last hundred opportunitys and count how many carry whatever join key you decide on.
  • If your Salesforce instance is heavily customized and administered by another team, scope their availability before commissioning this — the build is usually blocked on admin access rather than on the tracking work.
  • 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.

Salesforce → BigQuery · what we deliver

What gets built — Salesforce → BigQuery

  • Identifier capture into Salesforce

    Custom field on Lead, matching custom field on Contact and Opportunity, and the field mapping configured so conversion carries it across. Verify by converting a test lead and reading the resulting opportunity.

  • Event source: a Salesforce flow, Apex trigger or scheduled export on StageName change

    Fire on the transition into Closed Won, carrying the amount and the identifier. Note that Salesforce's own advertising integrations vary in what they support — build on the record, not on a connector that might change.

  • 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

    An opportunity moved back out of Closed Won can be retracted, and enterprise pipelines do this often enough to be worth wiring.

Written guarantee

95%+ tracking accuracy

Measured against A Salesforce report of Closed Won opportunities for the same window, by close date.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Salesforce → BigQuery questions, answered

Check BigQuery Data Transfer Service and connectors you already use first; otherwise an incremental loader on SystemModstamp works. Include OpportunityHistory, not just current Opportunities.

Free · 30 min

Get Salesforce and BigQuery joined properly

Free30 minutesNo obligation