Skip to main content
Craft → Marketing CloudIntegration guide

Connecting Craft CMS to Salesforce Marketing Cloud

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. Marketing Cloud is a different product from Salesforce CRM with a different identity model, which catches out almost everyone who assumes a contact in one is a contact in the other. The join between them succeeds or fails on one thing: whether the Subscriber Key reaches the Craft Commerce order before the conversion happens, because Marketing Cloud can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Craft Commerce to Marketing Cloud: data extension inserts from PHP

Insert Craft Commerce orders into a Marketing Cloud orders data extension whose primary key is the order reference, with a Subscriber Key column following the org's rule. Post rows from a queued job pushed by the order-complete listener, including fields the journey's splits use, so retries overwrite rather than re-entering customers.

On enterprise Craft builds, Marketing Cloud often already exists for email while the Craft site was added later by a different agency, so nobody has decided how a Craft customer maps to a Subscriber Key. Look before building. If Subscriber Key is the Salesforce CRM Contact ID, Craft has no way to know it for a new customer, and inserting by email creates a second subscriber.

A workable route is an orders data extension keyed on the Commerce order reference, with a Subscriber Key column filled according to whatever the org has decided: email, or a CRM lookup run before the insert. Post the row from a queued job pushed by the order-complete listener, so a Marketing Cloud API timeout does not slow checkout. Include the fields the post-purchase journey's decision splits reference, such as product type, total and shipping country.

Make the order reference the data extension's primary key. A queue retry then overwrites the same row instead of inserting a second one, which keeps the customer from entering the post-purchase journey twice. Test against a non-production business unit from a non-production Craft environment, since a staging database copied from production is full of real subscribers.

Craft → Marketing Cloud · what breaks

Why this join usually fails — Craft → Marketing Cloud

  1. 01

    The Subscriber Key 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

    Two identity models treated as one

    Marketing Cloud's Subscriber Key and CRM's Contact ID are separate concepts, and Contact Builder's configuration decides whether they relate at all. Getting this wrong does not produce an error — it produces a customer who exists twice, receives everything twice, and appears in reporting as two people.

  4. 04

    Nothing reconciles afterwards

    Check the subscriber record and the journey history, not the API response. A successful insert into an unwatched data extension looks identical to a successful one into the right extension.

Craft → Marketing Cloud · the fix

What working looks like — Craft → Marketing Cloud

  • The Subscriber Key on every order

  • Conversions arriving in Marketing Cloud

    The record lands in the data extension, the journey's entry criteria evaluate on its schedule, and sends follow.

  • Reconciled against the source

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

Craft → Marketing Cloud · architecture

How Craft and Marketing Cloud 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

    Salesforce Marketing Cloud needs a click to match

    The Subscriber Key, the data extension the journey listens to, and the fields its decision splits reference. An event landing in the wrong data extension will be stored correctly and trigger nothing.

  3. 3

    The identifier is the bridge

    The Subscriber Key, 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

    Marketing Cloud does not deduplicate journey entries for you. A record inserted twice can enter a journey twice, and because journeys span email, SMS and push the duplicate reaches the customer more than once.

Craft → Marketing Cloud · normal or broken

Working vs. broken, side by side — Craft → Marketing Cloud

Normal, not a fault

  • The Subscriber Key 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

    Marketing Cloud does not deduplicate journey entries for you. A record inserted twice can enter a journey twice, and because journeys span email, SMS and push the duplicate reaches the customer more than once.

  • Reconciles with the source

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

Actually broken

  • The Subscriber Key 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

    Marketing Cloud's Subscriber Key and CRM's Contact ID are separate concepts, and Contact Builder's configuration decides whether they relate at all. Getting this wrong does not produce an error — it produces a customer who exists twice, receives everything twice, and appears in reporting as two people.

  • Nobody has reconciled it

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

Craft → Marketing Cloud · diagnose

Diagnostic order — Craft → Marketing Cloud

  1. 01

    Count orders carrying the Subscriber Key

  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

    Confirm what Subscriber Key is actually set to in this org

    Before sending anything. It is a configuration decision made once, often years ago, and every integration built afterwards inherits it.

  5. 05

    Read the match rate, not the success message

    Check the subscriber record and the journey history, not the API response. A successful insert into an unwatched data extension looks identical to a successful one into the right extension.

Craft → Marketing Cloud · prove

How it gets proven — Craft → Marketing Cloud

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 Subscriber Key confirmed present on a live order.
  • Records confirmed on single subscriber records in the correct data extension, with the triggered journey verified in a non-production business unit first.
  • Order custom field confirmed populated on an order placed as an anonymous visitor through cache.

Craft → Marketing Cloud · free audit

What we check in the free audit

  • Count orders carrying the Subscriber Key
  • Follow one real conversion end to end
  • Read how this specific build handles order completion
  • Confirm what Subscriber Key is actually set to in this org
  • 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 → Marketing Cloud · when not to buy

When you don't need this — Craft → Marketing Cloud

  • If Marketing Cloud 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 Subscriber Key.
  • If the original agency is still engaged, the fastest path is usually specifying the field and having them add the hook.
  • If you are on Salesforce CRM but sending email through a simpler platform, adding Marketing Cloud brings an identity model to reconcile that you currently do not have to think about.

Craft → Marketing Cloud · what we deliver

What gets built — Craft → Marketing Cloud

  • 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 Marketing Cloud

    A server-side insert into the data extension the journey is configured against, keyed on Subscriber Key.

  • 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 → Marketing Cloud questions, answered

Insert each completed order into the data extension your journey listens to, from a queued job on order completion, with the order reference as primary key and the agreed Subscriber Key.

Free · 30 min

Get Craft and Marketing Cloud joined properly

Free30 minutesNo obligation