Skip to main content
Drupal Commerce → Microsoft AdsIntegration guide

Connecting Drupal Commerce to Microsoft Ads

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. Microsoft Ads reaches an older, higher-income, more desktop-weighted audience than Google, and it is routinely the cheapest qualified traffic a B2B advertiser can buy. The join between them succeeds or fails on one thing: whether the MSCLKID reaches the Drupal Commerce order before the conversion happens, because Microsoft Ads can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Drupal Commerce to Microsoft Ads: msclkid past the cache to the upload

Confirm auto-tagging is on and your CDN keeps msclkid, then persist it onto the draft order when the cart is created. Upload offline conversions from a commerce_order query filtered to agreed revenue states, with time zones declared. Upload invoice orders only once paid, retract cancellations, and keep one goal in bidding.

Microsoft's older, desktop-weighted audience matches a lot of Drupal Commerce buying: trade accounts, institutional purchasing, memberships. The join is offline import keyed on msclkid stored as order field data. Two checks come before any code: confirm auto-tagging is on in the Microsoft Ads account, then confirm your reverse proxy or CDN is not stripping msclkid from the URL before Drupal sees it, which some cache configurations do for query strings they do not recognize.

Persist the value onto the draft order when the cart is created rather than at checkout completion, because a buyer who lands on Monday and checks out on Thursday moves through many cached pages in between. The upload then comes straight from a query on commerce_order joined to that field, filtered to the states you agreed count as revenue, with the placed timestamp converted to the time zone your upload file declares.

Invoice-based B2B orders that sit unpaid for weeks are the trap. Upload on placement and an invoice that is never paid still teaches Microsoft to bid toward it. Upload on the transition you agreed means revenue, and retract or restate cancellations through Microsoft's offline conversion adjustments where your account supports them. If you also run a UET purchase goal on the completion page, keep only one of the two goals in bidding.

Drupal Commerce → Microsoft Ads · what breaks

Why this join usually fails — Drupal Commerce → Microsoft Ads

  1. 01

    The MSCLKID 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.

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

  3. 03

    Auto-tagging switched off

    Microsoft auto-tagging is frequently disabled in accounts that were set up quickly or imported from Google, and without it no MSCLKID arrives at all — so the entire offline import has nothing to match against and fails silently.

  4. 04

    Nothing reconciles afterwards

    Microsoft Ads reports offline conversion uploads with rows accepted and rejected. A successful upload is not a matched conversion — check that conversions actually appear against campaigns afterwards.

Drupal Commerce → Microsoft Ads · the fix

What working looks like — Drupal Commerce → Microsoft Ads

  • The MSCLKID on every order

  • Conversions arriving in Microsoft Ads

    Conversions appear against the campaign, ad group and keyword that produced the click, with the value you sent, and become usable for automated bidding.

  • Reconciled against the source

Drupal Commerce → Microsoft Ads · architecture

How Drupal Commerce and Microsoft Ads actually connect

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

    Microsoft Ads needs a click to match

    Microsoft matches uploaded conversions to clicks using the MSCLKID, and the conversion goal must be created as an offline conversion type. The click has to fall inside Microsoft's import window — verify the current limit in your account rather than assuming it matches Google's.

  3. 3

    The identifier is the bridge

    The MSCLKID, captured at the visit and carried into the Drupal Commerce order.

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

    Deduplication at the destination

    Microsoft deduplicates on the combination of click identifier, conversion name and conversion time. Uploading the same click against a second conversion goal counts twice, which is the usual cause of inflated numbers here.

Drupal Commerce → Microsoft Ads · normal or broken

Working vs. broken, side by side — Drupal Commerce → Microsoft Ads

Normal, not a fault

  • The MSCLKID present on the order

  • Sent from the Drupal Commerce order placement hook

  • Deduplicated correctly

    Microsoft deduplicates on the combination of click identifier, conversion name and conversion time. Uploading the same click against a second conversion goal counts twice, which is the usual cause of inflated numbers here.

  • Reconciles with the source

Actually broken

  • The MSCLKID 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

    Microsoft auto-tagging is frequently disabled in accounts that were set up quickly or imported from Google, and without it no MSCLKID arrives at all — so the entire offline import has nothing to match against and fails silently.

  • Nobody has reconciled it

Drupal Commerce → Microsoft Ads · diagnose

Diagnostic order — Drupal Commerce → Microsoft Ads

  1. 01

    Count orders carrying the MSCLKID

  2. 02

    Follow one real conversion end to end

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

  4. 04

    Confirm auto-tagging is enabled and check the upload diagnostics

    One account setting decides whether any of this works. Then read the per-row errors on the upload rather than the success count.

  5. 05

    Read the match rate, not the success message

    Microsoft Ads reports offline conversion uploads with rows accepted and rejected. A successful upload is not a matched conversion — check that conversions actually appear against campaigns afterwards.

Drupal Commerce → Microsoft Ads · prove

How it gets proven — Drupal Commerce → Microsoft Ads

Source of truth

Drupal's commerce_order records in your own database, filtered to completed states.

  • The MSCLKID confirmed present on a live order.
  • Auto-tagging confirmed on, and the accepted count reconciled against conversions appearing in campaign reporting.
  • Order field data confirmed populated on an order placed through a fully warmed cache as an anonymous visitor.

Drupal Commerce → Microsoft Ads · free audit

What we check in the free audit

  • Count orders carrying the MSCLKID
  • Follow one real conversion end to end
  • List the order states in use and agree which count as revenue
  • Confirm auto-tagging is enabled and check the upload diagnostics
  • Read the match rate, not the success message

Checked against

Drupal's commerce_order records in your own database, filtered to completed states.

Get my free conversion tracking audit

Free30 minutesNo obligation

Drupal Commerce → Microsoft Ads · when not to buy

When you don't need this — Drupal Commerce → Microsoft Ads

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the MSCLKID.
  • If your Drupal site is content-only with commerce elsewhere, work at the commerce system instead — this is the wrong layer.
  • If you are not running Microsoft Ads at meaningful spend, skip it — though for B2B the traffic is often cheaper and better qualified than people expect, which is worth testing before dismissing.

Drupal Commerce → Microsoft Ads · what we deliver

What gets built — Drupal Commerce → Microsoft Ads

  • 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 Microsoft Ads

    Offline conversion import through the Microsoft Advertising API or a scheduled upload.

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

Get my free conversion tracking audit

From $400 · See packages

FAQ

Drupal Commerce → Microsoft Ads questions, answered

Store msclkid on the order, create an offline conversion goal in Microsoft Ads, then upload orders in your agreed revenue states with msclkid, conversion name, time and value by file, scheduled upload or the API.

Free · 30 min

Get Drupal Commerce and Microsoft Ads joined properly

Free30 minutesNo obligation