Skip to main content
Mailgun → BranchIntegration guide

Connecting Mailgun to Branch

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. Branch's real job is the web-to-app seam — a person clicks a link in a browser, installs the app, and something has to carry the context across an install that destroys every cookie involved. The join between them succeeds or fails on one thing: whether the Branch link click identifier and the deferred deep link payload reaches the Mailgun message before the conversion happens, because Branch can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Magic links via Mailgun that survive into the app with Branch

For Mailgun authentication emails like magic links or verification, turn off click tracking so tokens don't pass through a tracking hop, and make the link a Branch link on your own domain carrying the destination. Deferred deep linking keeps context through install, but align token expiry with install time. Revenue goes to Branch's server-to-server API from billing, not Mailgun.

The Mailgun-and-Branch case is usually authentication: a sign-in magic link, an email verification or a password reset that should open the app on a phone and continue the web journey if the app is not installed yet. Mailgun's click tracking wraps those links in its redirect, which breaks Universal Links and, worse, routes a live sign-in token through a tracking hop and into click logs.

Send authentication emails with click tracking turned off for those messages, and make the link itself a Branch link on your own domain so the deep link data carries the destination. Branch's deferred deep linking then holds that context through an install, so a new user who taps a verification link lands on the verified state on first open instead of the app's home screen. Check whether Branch documents a click-tracking domain setup for Mailgun if you want tracking kept on marketing sends.

Treat token expiry and deferred deep links together. If the install takes ten minutes and the token expires in five, the deep link arrives intact and the sign-in still fails, and the user looks like a broken funnel step. Revenue events go to Branch's server-to-server API from billing with a shared event identifier, never from Mailgun, which only knows a message was sent.

Mailgun → Branch · what breaks

Why this join usually fails — Mailgun → Branch

  1. 01

    The Branch link click identifier and the deferred deep link payload 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

    The install that erases the campaign

    Someone clicks a paid ad on the mobile web, hits the app store, installs, and opens the app as a brand new anonymous user. Without deferred deep linking that campaign produced an organic install, and the ad account shows nothing for a conversion it genuinely caused.

  4. 04

    Nothing reconciles afterwards

    Branch shows the attributed link and campaign on the event in its dashboard. Check that the install carries a link click rather than showing as organic, which is the failure this product exists to prevent.

Mailgun → Branch · the fix

What working looks like — Mailgun → Branch

  • The Branch link click identifier and the deferred deep link payload on every message

  • Conversions arriving in Branch

    The event is attributed to the originating link and campaign, and forwarded to any configured downstream partners.

  • Reconciled against the source

Mailgun → Branch · architecture

How Mailgun and Branch 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

    Branch needs a click to match

    Branch needs the link click context matched to the app open, plus the event and its revenue. Without the deferred deep link payload there is nothing to join the install to.

  3. 3

    The identifier is the bridge

    The Branch link click identifier and the deferred deep link payload, 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

    Branch deduplicates on the event identifier you supply. Firing a purchase from both the SDK and your server without a shared identifier double-counts, and Branch forwards to downstream partners, so the duplicate propagates.

Mailgun → Branch · normal or broken

Working vs. broken, side by side — Mailgun → Branch

Normal, not a fault

  • The Branch link click identifier and the deferred deep link payload present on the message

  • Sent from your order system

  • Deduplicated correctly

    Branch deduplicates on the event identifier you supply. Firing a purchase from both the SDK and your server without a shared identifier double-counts, and Branch forwards to downstream partners, so the duplicate propagates.

  • Reconciles with the source

Actually broken

  • The Branch link click identifier and the deferred deep link payload 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

    Someone clicks a paid ad on the mobile web, hits the app store, installs, and opens the app as a brand new anonymous user. Without deferred deep linking that campaign produced an organic install, and the ad account shows nothing for a conversion it genuinely caused.

  • Nobody has reconciled it

Mailgun → Branch · diagnose

Diagnostic order — Mailgun → Branch

  1. 01

    Count messages carrying the Branch link click identifier and the deferred deep link payload

  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

    Measure your organic install share and ask whether it is plausible

    An implausibly large organic share is usually broken attribution rather than genuine word of mouth.

  5. 05

    Read the match rate, not the success message

    Branch shows the attributed link and campaign on the event in its dashboard. Check that the install carries a link click rather than showing as organic, which is the failure this product exists to prevent.

Mailgun → Branch · prove

How it gets proven — Mailgun → Branch

Source of truth

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

  • The Branch link click identifier and the deferred deep link payload confirmed present on a live message.
  • Attributed installs and in-app purchases reconciled against your own user records, with the unattributed share stated.
  • Orders reconciled against imported conversions, with the send inventory documented.

Mailgun → Branch · free audit

What we check in the free audit

  • Count messages carrying the Branch link click identifier and the deferred deep link payload
  • Follow one real conversion end to end
  • Inventory every code path that triggers a send
  • Measure your organic install share and ask whether it is plausible
  • 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 → Branch · when not to buy

When you don't need this — Mailgun → Branch

  • Measure identifier coverage yourself first — pull your last hundred messages and count how many carry the Branch link click identifier and the deferred deep link payload.
  • Deliverability monitoring is the right use of Mailgun's data. Attribution belongs at the order.
  • If you have no app, or no web surface driving app installs, there is no seam here to bridge and the integration solves nothing.

Mailgun → Branch · what we deliver

What gets built — Mailgun → Branch

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

    The Branch server-to-server events API, posted from your backend with the user identity and event data.

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

Mailgun click tracking rewrites the link to its own redirect domain, which iOS does not associate with your app. Turn off click tracking on authentication emails and use a Branch link on your domain.

Free · 30 min

Get Mailgun and Branch joined properly

Free30 minutesNo obligation