Connecting Drupal Commerce to HubSpot
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. HubSpot is where sales works, so a conversion that never reaches it is invisible to the people who decide what a lead was worth. The join between them succeeds or fails on one thing: whether the contact identity — email, or the hubspotutk cookie reaches the Drupal Commerce order before the conversion happens, because HubSpot can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Drupal Commerce to HubSpot: orders onto contacts with the hutk intact
The contributed HubSpot module covers Webforms, not Commerce orders. From the order's place transition, submit the order email with the hubspotutk as hutk context through HubSpot's Forms API so original source survives. Don't open a deal per trade-account reorder, and move deals to Closed Won only on the agreed revenue transition.
Drupal sites that sell through Commerce often already talk to HubSpot through the contributed HubSpot module, which posts Webform submissions to HubSpot forms. That covers enquiries, not orders: a Commerce checkout is not a Webform, so placed orders never reach HubSpot unless you send them. Confirm what the module version on your site covers before assuming otherwise.
Checkout requests are not served from the page cache, so an event subscriber on the order's place transition can read the hubspotutk cookie straight from the request. Submit it as the hutk context through HubSpot's Forms API alongside the order email; the plain contacts API does not take it, and without it HubSpot cannot attach the buyer's earlier page views or original source. For the B2B stores Drupal Commerce is common in, such as memberships, registrations and trade accounts, decide whether an order closes an existing deal or is logged as revenue on the company. Repeat orders from a trade account should not open a new deal each time.
Two Drupal-specific breaks. Anonymous checkout with an email that differs from the one the person used on an earlier HubSpot form produces a second contact, so normalize on the email you trust. And because workflow states are configurable, an invoice-based B2B order can reach a completed-looking state before it is paid; move the HubSpot deal to Closed Won only on the transition you agreed counts as revenue.
Drupal Commerce → HubSpot · what breaks
Why this join usually fails — Drupal Commerce → HubSpot
- 01
The contact identity — email, or the hubspotutk cookie 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.
- 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.
- 03
Duplicate contacts
Two records for one person, each with half the history. Every downstream report is then wrong in a way that looks like a data problem rather than an integration problem.
- 04
Nothing reconciles afterwards
HubSpot shows the contact record and its timeline. A successful API response means HubSpot accepted the call, not that it resolved to the right contact — open the record and look.
Drupal Commerce → HubSpot · the fix
What working looks like — Drupal Commerce → HubSpot
The contact identity — email, or the hubspotutk cookie on every order
Conversions arriving in HubSpot
The revenue or conversion lands on the contact record and its associated deal, where sales can see it and where HubSpot's own attribution reporting can use it.
Reconciled against the source
Drupal Commerce → HubSpot · architecture
How Drupal Commerce and HubSpot actually connect
- 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
HubSpot needs a click to match
HubSpot needs to resolve the incoming data to an existing contact or create one. Without an email or a hubspotutk it creates duplicates, and duplicate contacts break every report built on top of them.
- 3
The identifier is the bridge
The contact identity — email, or the hubspotutk cookie, captured at the visit and carried into the Drupal Commerce order.
- 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
Deduplication at the destination
HubSpot deduplicates contacts on email address. Events and property updates against the same contact are idempotent by design, but a second contact created for the same person is not detected, and merging them afterwards is manual work.
Drupal Commerce → HubSpot · normal or broken
Working vs. broken, side by side — Drupal Commerce → HubSpot
Normal, not a fault
The contact identity — email, or the hubspotutk cookie present on the order
Sent from the Drupal Commerce order placement hook
Deduplicated correctly
HubSpot deduplicates contacts on email address. Events and property updates against the same contact are idempotent by design, but a second contact created for the same person is not detected, and merging them afterwards is manual work.
Reconciles with the source
Actually broken
The contact identity — email, or the hubspotutk cookie 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
Two records for one person, each with half the history. Every downstream report is then wrong in a way that looks like a data problem rather than an integration problem.
Nobody has reconciled it
Drupal Commerce → HubSpot · diagnose
Diagnostic order — Drupal Commerce → HubSpot
- 01
Count orders carrying the contact identity — email, or the hubspotutk cookie
- 02
Follow one real conversion end to end
- 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.
- 04
Search for the test contact by email after sending
One record or two? Then check whether the properties landed on the contact or only on the form submission — they are different things and only the first is usable.
- 05
Read the match rate, not the success message
HubSpot shows the contact record and its timeline. A successful API response means HubSpot accepted the call, not that it resolved to the right contact — open the record and look.
Drupal Commerce → HubSpot · prove
How it gets proven — Drupal Commerce → HubSpot
Source of truth
Drupal's commerce_order records in your own database, filtered to completed states.
- The contact identity — email, or the hubspotutk cookie confirmed present on a live order.
- One contact record confirmed, not two, with the property visible on the contact rather than only on the submission.
- Order field data confirmed populated on an order placed through a fully warmed cache as an anonymous visitor.
Drupal Commerce → HubSpot · free audit
What we check in the free audit
- Count orders carrying the contact identity — email, or the hubspotutk cookie
- Follow one real conversion end to end
- List the order states in use and agree which count as revenue
- Search for the test contact by email after sending
- Read the match rate, not the success message
Checked against
Drupal's commerce_order records in your own database, filtered to completed states.
Free30 minutesNo obligation
Drupal Commerce → HubSpot · when not to buy
When you don't need this — Drupal Commerce → HubSpot
- Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the contact identity — email, or the hubspotutk cookie.
- If your Drupal site is content-only with commerce elsewhere, work at the commerce system instead — this is the wrong layer.
- HubSpot's native form and tracking code already handle the straightforward cases well. This is worth building when the conversion happens somewhere HubSpot's code cannot see.
Drupal Commerce → HubSpot · what we deliver
What gets built — Drupal Commerce → HubSpot
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 HubSpot
The HubSpot API — contact create-or-update with the properties, or a custom behavioral event where you need the timeline entry rather than a property.
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.
From $400 · See packages
FAQ
Drupal Commerce → HubSpot questions, answered
In most installs it maps Webform submissions to HubSpot forms, so Commerce orders need a custom subscriber or an integration layer. Check the module version you run.
Read the hubspotutk cookie at order placement and submit it as the hutk context with the order email through HubSpot's Forms API. HubSpot then ties the earlier page views to that contact.
Almost always because the contact identity — email, or the hubspotutk cookie never reached the Drupal Commerce order. 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. Measure coverage before debugging the dispatch.
HubSpot resolves to a contact by email address, or by the hubspotutk cookie value which ties an anonymous visitor to their eventual contact record. Sending the hubspotutk with a form submission is what lets HubSpot stitch the pre-conversion page views to the contact, which is where the original source attribution comes from.
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.
HubSpot shows the contact record and its timeline. A successful API response means HubSpot accepted the call, not that it resolved to the right contact — open the record and look.
More on Drupal Commerce → HubSpot
- Squarespace → HubSpotConnecting Squarespace Commerce to HubSpot
- Drupal Commerce → Google AdsConnecting Drupal Commerce to Google Ads
- Drupal Commerce → MetaConnecting Drupal Commerce to Meta Conversions API
RELATED GUIDES
Where Drupal Commerce → HubSpot fits in the rest of your tracking
- Umbraco → HubSpotConnecting Umbraco to HubSpot
- Statamic → HubSpotConnecting Statamic to HubSpot
- Webflow → HubSpotConnecting Webflow to HubSpot
- Drupal Commerce → 6senseConnecting Drupal Commerce to 6sense
- Drupal Commerce → SalesforceConnecting Drupal Commerce to Salesforce
- Local servicesConversion tracking for local businesses, where most conversions bypass the website
- Contentful → HubSpotConnecting Contentful to HubSpot
- Concrete CMS → HubSpotConnecting Concrete CMS to HubSpot
Free · 30 min
Get Drupal Commerce and HubSpot joined properly
Free30 minutesNo obligation
