Connecting Craft CMS to Salesforce
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. Sending conversions into Salesforce rather than out of it is how marketing data reaches the place sales actually works. The join between them succeeds or fails on one thing: whether the Lead or Contact identity reaches the Craft Commerce order before the conversion happens, because Salesforce can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Craft CMS into Salesforce: form leads first, Commerce orders rarely
Most Craft sites send form leads, not orders, to Salesforce through Freeform or Formie's integration. Fill hidden gclid, fbclid and UTM fields by script, not cached Twig, map them to custom Lead fields that survive conversion, and test an anonymous lead. Send only wholesale or trade Commerce orders, matched to an Account.
Most Craft sites that need Salesforce aren't stores; they are marketing sites for B2B firms, with leads arriving through a form plugin such as Freeform or Formie. Check whether your edition of that plugin includes a Salesforce integration and how it maps fields, because that is the route most Craft builds take. Add hidden fields for gclid, fbclid and UTM values, filled by script, and map each to a custom Lead field.
Hidden fields fail on cached form templates when Twig renders the values instead of a script setting them at submit time; every lead then carries whichever source was cached. Submit a test lead as an anonymous visitor, then open the Lead in Salesforce, because a validation rule can drop a field the plugin reports as sent. Map the fields onward so they survive Lead conversion to the Contact and Opportunity, which is where closed-won value gets reported back to ad platforms.
If the Craft site is a Commerce store, Salesforce is usually the wrong destination for consumer orders: you'd create a Contact per buyer with no sales process behind it. The exception is wholesale or trade orders that reps follow up. There, write the Commerce order reference and total to the matched Account or a custom object, matched on email or company domain, and leave retail orders out.
Craft → Salesforce · what breaks
Why this join usually fails — Craft → Salesforce
- 01
The Lead or Contact identity 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.
- 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.
- 03
Writes that succeed and change nothing
Field-level security, validation rules and required-field constraints can reject a write while the API reports success. Open the record and look rather than trusting the response.
- 04
Nothing reconciles afterwards
Check the record in Salesforce itself, not the API response. Then confirm the value survives Lead conversion onto the Contact, Account and Opportunity — the mapping is separate and is usually the thing that was missed.
Craft → Salesforce · the fix
What working looks like — Craft → Salesforce
The Lead or Contact identity on every order
Conversions arriving in Salesforce
The marketing context appears on the record and flows into the opportunity, where sales and reporting can both use it.
Reconciled against the source
Craft CMS's own records are the reference, not either dashboard.
Craft → Salesforce · architecture
How Craft and Salesforce actually connect
- 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
Salesforce needs a click to match
Salesforce needs a resolvable record and a custom field to write to. Field-level security and validation rules can silently reject writes, which is a Salesforce-specific failure that returns success at the API level and changes nothing.
- 3
The identifier is the bridge
The Lead or Contact identity, captured at the visit and carried into the Craft Commerce order.
- 4
The event source decides reliability
Fire from the event listener in PHP rather than a Twig template, which may be cached.
- 5
Deduplication at the destination
Salesforce deduplicates according to whatever matching rules your org has configured, which vary enormously between instances. Duplicate Leads are the standard failure and merging them afterwards is manual work.
Craft → Salesforce · normal or broken
Working vs. broken, side by side — Craft → Salesforce
Normal, not a fault
The Lead or Contact identity 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
Salesforce deduplicates according to whatever matching rules your org has configured, which vary enormously between instances. Duplicate Leads are the standard failure and merging them afterwards is manual work.
Reconciles with the source
Salesforce's count and Craft CMS's records agree within a few percent over a closed window.
Actually broken
The Lead or Contact identity 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
Field-level security, validation rules and required-field constraints can reject a write while the API reports success. Open the record and look rather than trusting the response.
Nobody has reconciled it
The dashboard shows a number and no one has compared it to Craft CMS.
Craft → Salesforce · diagnose
Diagnostic order — Craft → Salesforce
- 01
Count orders carrying the Lead or Contact identity
- 02
Follow one real conversion end to end
- 03
Read how this specific build handles order completion
Assumptions carried from another Craft project are the main source of wasted time here.
- 04
Write a test value and open the record in the UI
The API saying it worked and the field actually holding the value are different things in Salesforce more than anywhere else.
- 05
Read the match rate, not the success message
Check the record in Salesforce itself, not the API response. Then confirm the value survives Lead conversion onto the Contact, Account and Opportunity — the mapping is separate and is usually the thing that was missed.
Craft → Salesforce · prove
How it gets proven — Craft → Salesforce
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.
- The Lead or Contact identity confirmed present on a live order.
- A test value confirmed present on the record in the UI, and confirmed to survive Lead conversion.
- Order custom field confirmed populated on an order placed as an anonymous visitor through cache.
Craft → Salesforce · free audit
What we check in the free audit
- Count orders carrying the Lead or Contact identity
- Follow one real conversion end to end
- Read how this specific build handles order completion
- Write a test value and open the record in the UI
- Read the match rate, not the success message
Checked against
Craft Commerce's order records in your own database, filtered to completed.
Free30 minutesNo obligation
Craft → Salesforce · when not to buy
When you don't need this — Craft → Salesforce
- If Salesforce 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 the Lead or Contact identity.
- If the original agency is still engaged, the fastest path is usually specifying the field and having them add the hook.
- If your Salesforce org is administered by a team you cannot get time with, scope their availability before starting — this build is usually blocked on admin access rather than on the work.
Craft → Salesforce · what we deliver
What gets built — Craft → Salesforce
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 Salesforce
API writes to the Lead or Contact record, or a platform event, carrying the marketing context as custom field values.
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.
From $400 · See packages
FAQ
Craft → Salesforce questions, answered
Add a hidden field to the Freeform or Formie form, populate it from a stored cookie by script at submit, and map it to a custom Lead field in the plugin's Salesforce integration. Then check the value on a real Lead record.
For consumer retail, usually not. Send wholesale or account orders only, matched to existing Accounts by email or domain.
Almost always because the Lead or Contact identity never reached the Craft Commerce order. 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. Measure coverage before debugging the dispatch.
Salesforce resolves on its own record identity — a Lead, a Contact, or an Account — rather than on a click identifier. What you are doing here is attaching marketing context to a record so the pipeline carries it, which means the click identifier arrives as a custom field value rather than as a matching key. The hazard is duplicates: two Leads for one person means two records with half the history each.
The Craft Commerce order-complete event. Fire from the event listener in PHP rather than a Twig template, which may be cached.
Check the record in Salesforce itself, not the API response. Then confirm the value survives Lead conversion onto the Contact, Account and Opportunity — the mapping is separate and is usually the thing that was missed.
More on Craft → Salesforce
- Craft → Marketing CloudConnecting Craft CMS to Salesforce Marketing Cloud
- Craft → Google AdsConnecting Craft CMS to Google Ads
- Craft → MetaConnecting Craft CMS to Meta Conversions API
RELATED GUIDES
Where Craft → Salesforce fits in the rest of your tracking
- Concrete CMS → SalesforceConnecting Concrete CMS to Salesforce
- Drupal Commerce → SalesforceConnecting Drupal Commerce to Salesforce
- Sanity → SalesforceConnecting Sanity to Salesforce
- Craft → HubSpotConnecting Craft CMS to HubSpot
- Craft → MarketoConnecting Craft CMS to Marketo
- Local servicesConversion tracking for local businesses, where most conversions bypass the website
- Contentful → SalesforceConnecting Contentful to Salesforce
- Statamic → SalesforceConnecting Statamic to Salesforce
Free · 30 min
Get Craft and Salesforce joined properly
Free30 minutesNo obligation
