Skip to main content
Statamic → SalesforceIntegration guide

Connecting Statamic to Salesforce

Statamic is a flat-file CMS on Laravel, usually chosen by agencies for content sites where commerce is bolted on rather than central. 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 Statamic or Laravel order record 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

Statamic forms to Salesforce Leads with source fields intact

Fill hidden Statamic form fields with click IDs, UTM values and landing page via JavaScript, then have a Laravel listener write them to custom Salesforce Lead fields through the API, or check for a marketplace addon. Look up existing Leads or Contacts by email first. Refresh CSRF tokens on cached forms, and verify fields in Salesforce after testing.

This is the most common real use of this pair: an agency-built Statamic site whose forms should create Salesforce Leads with marketing context attached. The click IDs, UTM values and landing page belong in hidden form fields filled by JavaScript, because cached pages run no PHP per visitor, and a Laravel listener on submission writes them to custom Lead fields through the API.

Check the Statamic marketplace for a Salesforce form addon before writing one, and confirm what it maps. Web-to-Lead is the low-effort option but gives you less control over duplicate handling and field errors. Whichever route, have the listener look up an existing Lead or Contact by email first, because a returning visitor submitting a second form is otherwise a second Lead with half the history.

The Statamic-specific failure is silent loss. If the site has full static caching and the CSRF token on cached forms is not refreshed, submissions fail before the listener runs, and nothing reaches Salesforce. Combine that with Salesforce writes that report success while a validation rule drops the field, and you can lose source data at two points. Test with a cached page, then open the Lead in Salesforce and read the fields.

Statamic → Salesforce · what breaks

Why this join usually fails — Statamic → Salesforce

  1. 01

    The Lead or Contact identity never reaches Statamic

    Statamic's static caching serves pre-rendered files with no PHP execution at all, which means anything expecting server-side rendering per request simply does not run.

  2. 02

    Static caching bypassing PHP entirely

    Statamic's full static caching serves a file from disk. No PHP runs, so nothing dynamic happens — and this is invisible because the page looks perfect.

  3. 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.

  4. 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.

Statamic → Salesforce · the fix

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

Statamic → Salesforce · architecture

How Statamic and Salesforce actually connect

  1. 1

    Statamic holds the truth

    Because Statamic sits on Laravel, the commercial record is usually a database table your developers defined. That is the source of truth and it is fully under your control.

  2. 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. 3

    The identifier is the bridge

    The Lead or Contact identity, captured at the visit and carried into the Statamic or Laravel order record.

  4. 4

    The event source decides reliability

    Fire from the application event. Static caching means the template that rendered the page may never have executed anything.

  5. 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.

Statamic → Salesforce · normal or broken

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

Normal, not a fault

  • The Lead or Contact identity present on the order

  • Sent from your Laravel application's order 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

Actually broken

  • The Lead or Contact identity missing on most records

    Statamic's static caching serves pre-rendered files with no PHP execution at all, which means anything expecting server-side rendering per request simply does not run.

  • Sent from the browser

    Statamic's full static caching serves a file from disk. No PHP runs, so nothing dynamic happens — and this is invisible because the page looks perfect.

  • 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

Statamic → Salesforce · diagnose

Diagnostic order — Statamic → Salesforce

  1. 01

    Count orders carrying the Lead or Contact identity

  2. 02

    Follow one real conversion end to end

  3. 03

    Check whether full static caching is enabled

    If it is, any per-request logic in a template is not running and never was.

  4. 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.

  5. 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.

Statamic → Salesforce · prove

How it gets proven — Statamic → Salesforce

Source of truth

Whatever your Laravel application persists — Statamic's flat files hold content, not transactions.

  • 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 data confirmed persisted on a purchase made while full static caching was active.

Statamic → 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
  • Check whether full static caching is enabled
  • Write a test value and open the record in the UI
  • Read the match rate, not the success message

Checked against

Whatever your Laravel application persists — Statamic's flat files hold content, not transactions.

Get my free conversion tracking audit

Free30 minutesNo obligation

Statamic → Salesforce · when not to buy

When you don't need this — Statamic → Salesforce

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the Lead or Contact identity.
  • If commerce lives in a separate system entirely, work there — Statamic is the content layer.
  • 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.

Statamic → Salesforce · what we deliver

What gets built — Statamic → Salesforce

  • Identifier capture into Statamic

    Capture the identifier and persist it through a Laravel event listener into your own order table, entirely outside the static cache path.

  • Event source: your Laravel application's order event

    Fire from the application event. Static caching means the template that rendered the page may never have executed anything.

  • 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

    Whatever your application defines as a refund.

Written guarantee

95%+ tracking accuracy

Measured against Whatever your Laravel application persists — Statamic's flat files hold content, not transactions.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Statamic → Salesforce questions, answered

Use a Laravel listener on form submission to write the Lead through the Salesforce API, including hidden click ID and UTM fields filled by JavaScript. Check the Statamic marketplace for an existing addon first.

Free · 30 min

Get Statamic and Salesforce joined properly

Free30 minutesNo obligation