Skip to main content
Mailgun → Microsoft AdsIntegration guide

Connecting Mailgun to Microsoft Ads

Mailgun is developer-facing email infrastructure, which means the sending logic lives in your application and the marketing team frequently does not know what is being sent or when. 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 Mailgun message 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

Mailgun to Microsoft Ads: upload orders, flag lifecycle-driven ones

Microsoft Ads offline imports come from your order system, with the msclkid stored at checkout; Mailgun carries none. Record the Mailgun trigger and message ID on each order to see how many search-credited orders followed an email. Keep the first-party msclkid cookie for the click window and never overwrite it with an empty value when visitors return from email.

Microsoft Ads offline imports are built on the msclkid, and nothing Mailgun sends or logs carries one. The upload comes from your order system: msclkid stored at checkout, captured order uploaded to an offline goal. Mailgun's role is to answer one question inside that data: did a transactional or lifecycle email from your application trigger this order after the original search click?

That matters because Microsoft credits the order to the search click as long as it falls inside the conversion window, even when the real nudge was a cart reminder or reorder notice your app sent through Mailgun days later. Record the Mailgun trigger and message ID on the order, then report Microsoft-credited orders with and without a preceding email to see how much of the search credit is really retention.

There is a practical Microsoft-specific check too. If your Mailgun messages link back to your site, make sure the site does not overwrite a stored msclkid with an empty value when a visitor returns from email without one. Keep the first-party msclkid cookie for the click window and replace it only when a new msclkid arrives. Otherwise every email click quietly breaks the offline import for that customer.

Mailgun → Microsoft Ads · what breaks

Why this join usually fails — Mailgun → Microsoft Ads

  1. 01

    The MSCLKID never reaches Mailgun

    No session, no click, and the trigger conditions are buried in application code rather than in a campaign tool.

  2. 02

    Nobody able to say why a message was sent

    When send logic lives in application code, the marketing team cannot audit it and the engineering team is not thinking about attribution. Messages accumulate, nobody owns the list, and any analysis of email's contribution is unreliable.

  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.

Mailgun → Microsoft Ads · the fix

What working looks like — Mailgun → Microsoft Ads

  • The MSCLKID on every message

  • 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

Mailgun → Microsoft Ads · architecture

How Mailgun and Microsoft Ads actually connect

  1. 1

    Mailgun holds the truth

    Because sends are triggered in code, the only reliable description of why a message went out lives in your application, not in Mailgun's logs.

  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 Mailgun message.

  4. 4

    The event source decides reliability

    Send orders. Use Mailgun events for deliverability monitoring only.

  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.

Mailgun → Microsoft Ads · normal or broken

Working vs. broken, side by side — Mailgun → Microsoft Ads

Normal, not a fault

  • The MSCLKID present on the message

  • Sent from your order system

  • 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

    No session, no click, and the trigger conditions are buried in application code rather than in a campaign tool.

  • Sent from the browser

    When send logic lives in application code, the marketing team cannot audit it and the engineering team is not thinking about attribution. Messages accumulate, nobody owns the list, and any analysis of email's contribution is unreliable.

  • 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

Mailgun → Microsoft Ads · diagnose

Diagnostic order — Mailgun → Microsoft Ads

  1. 01

    Count messages carrying the MSCLKID

  2. 02

    Follow one real conversion end to end

  3. 03

    Inventory every code path that triggers a send

    Usually the first time anyone has, and it frequently finds sends nobody remembers building.

  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.

Mailgun → Microsoft Ads · prove

How it gets proven — Mailgun → Microsoft Ads

Source of truth

Your application's own record of what triggered the send, joined to the order.

  • The MSCLKID confirmed present on a live message.
  • Auto-tagging confirmed on, and the accepted count reconciled against conversions appearing in campaign reporting.
  • Orders reconciled against imported conversions, with the send inventory documented.

Mailgun → Microsoft Ads · free audit

What we check in the free audit

  • Count messages carrying the MSCLKID
  • Follow one real conversion end to end
  • Inventory every code path that triggers a send
  • Confirm auto-tagging is enabled and check the upload diagnostics
  • Read the match rate, not the success message

Checked against

Your application's own record of what triggered the send, joined to the order.

Get my free conversion tracking audit

Free30 minutesNo obligation

Mailgun → Microsoft Ads · when not to buy

When you don't need this — Mailgun → Microsoft Ads

  • Measure identifier coverage yourself first — pull your last hundred messages and count how many carry the MSCLKID.
  • Deliverability monitoring is the right use of Mailgun's data. Attribution belongs at the order.
  • 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.

Mailgun → Microsoft Ads · what we deliver

What gets built — Mailgun → Microsoft Ads

  • Identifier capture into Mailgun

    Record the trigger reason on the message in your own system and attribute at the order.

  • Event source: your order system

    Send orders. Use Mailgun events for deliverability monitoring only.

  • Dispatch to Microsoft Ads

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

  • Reversals where they exist

    Refunds reverse at the order.

Written guarantee

95%+ tracking accuracy

Measured against Your application's own record of what triggered the send, joined to the order.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Mailgun → Microsoft Ads questions, answered

No. Microsoft offline imports need an msclkid, which email clicks don't have. Upload orders from your order system and use Mailgun data to flag email-assisted ones.

Free · 30 min

Get Mailgun and Microsoft Ads joined properly

Free30 minutesNo obligation