Connecting Mailgun to TikTok Events API
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. TikTok's audience skews to exactly the browsers and app contexts where browser-side tracking performs worst. The join between them succeeds or fails on one thing: whether the ttclid reaches the Mailgun message before the conversion happens, because TikTok can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Mailgun to TikTok: matching email-closed orders to TikTok clicks
Store the ttclid server-side against the cart or customer on arrival, because a Mailgun reminder reopens outside TikTok's webview. When checkout completes through the email link, send CompletePayment with the stored ttclid, order ID as event_id, and hashed email and phone. Never forward Mailgun clicks, and count TikTok-attributed orders that followed a triggered send.
TikTok shoppers often browse in the in-app browser, leave, and come back later, frequently through an email. If your code sends a Mailgun reminder after a cart was abandoned in TikTok's webview, the return click opens in the phone's mail app or default browser, a different context with none of TikTok's cookies. The ttclid only survives if you stored it server-side against the cart or customer when they first arrived.
That makes the order record the join. When the customer completes checkout through the email link, look up the ttclid stored against their cart or email and send CompletePayment with it, the order ID as event_id, and hashed email and phone. Hashed email works well here, because the address on the order is one your Mailgun sends have already shown delivers.
Never forward Mailgun clicked events to TikTok; some email clicks come from link scanners, and TikTok cannot tell them apart. Check also whether reminders are closing purchases TikTok gets credit for: count TikTok-attributed orders that followed a triggered send, so the channel is not scaled on revenue the email program produced.
Mailgun → TikTok · what breaks
Why this join usually fails — Mailgun → TikTok
- 01
The ttclid never reaches Mailgun
No session, no click, and the trigger conditions are buried in application code rather than in a campaign tool.
- 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.
- 03
The ttclid is lost in the in-app browser
TikTok traffic arrives through an in-app webview whose storage behavior is inconsistent. An identifier captured but not immediately persisted server-side often is not there by the time the conversion happens.
- 04
Nothing reconciles afterwards
TikTok Events Manager shows received events and their match status. As with Meta, arriving is not the test — deduplicated and matched is. Reconcile TikTok's reported conversions against the source system for the same window.
Mailgun → TikTok · the fix
What working looks like — Mailgun → TikTok
The ttclid on every message
Conversions arriving in TikTok
Events appear in TikTok Events Manager, deduplicated against the pixel, and become usable for optimization.
Reconciled against the source
Mailgun → TikTok · architecture
How Mailgun and TikTok actually connect
- 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
TikTok Events API needs a click to match
TikTok matches server events using ttclid where available, falling back to hashed contact information. Both should be sent — the fallback is what carries the events where the click ID did not survive.
- 3
The identifier is the bridge
The ttclid, captured at the visit and carried into the Mailgun message.
- 4
The event source decides reliability
Send orders. Use Mailgun events for deliverability monitoring only.
- 5
Deduplication at the destination
TikTok deduplicates on event_id, the same pattern as Meta: the pixel and the Events API must send the same event_id for the same conversion. Mismatched IDs mean double counting.
Mailgun → TikTok · normal or broken
Working vs. broken, side by side — Mailgun → TikTok
Normal, not a fault
The ttclid present on the message
Sent from your order system
Deduplicated correctly
TikTok deduplicates on event_id, the same pattern as Meta: the pixel and the Events API must send the same event_id for the same conversion. Mismatched IDs mean double counting.
Reconciles with the source
Actually broken
The ttclid 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
TikTok traffic arrives through an in-app webview whose storage behavior is inconsistent. An identifier captured but not immediately persisted server-side often is not there by the time the conversion happens.
Nobody has reconciled it
Mailgun → TikTok · diagnose
Diagnostic order — Mailgun → TikTok
- 01
Count messages carrying the ttclid
- 02
Follow one real conversion end to end
- 03
Inventory every code path that triggers a send
Usually the first time anyone has, and it frequently finds sends nobody remembers building.
- 04
Measure ttclid capture rate on TikTok traffic specifically
Not on all traffic. TikTok's in-app browser is the failure case, so a healthy overall capture rate can hide a poor one on exactly the traffic that matters.
- 05
Read the match rate, not the success message
TikTok Events Manager shows received events and their match status. As with Meta, arriving is not the test — deduplicated and matched is. Reconcile TikTok's reported conversions against the source system for the same window.
Mailgun → TikTok · prove
How it gets proven — Mailgun → TikTok
Source of truth
Your application's own record of what triggered the send, joined to the order.
- The ttclid confirmed present on a live message.
- Deduplication confirmed in Events Manager, and ttclid capture rate measured on TikTok traffic specifically.
- Orders reconciled against imported conversions, with the send inventory documented.
Mailgun → TikTok · free audit
What we check in the free audit
- Count messages carrying the ttclid
- Follow one real conversion end to end
- Inventory every code path that triggers a send
- Measure ttclid capture rate on TikTok traffic specifically
- Read the match rate, not the success message
Checked against
Your application's own record of what triggered the send, joined to the order.
Free30 minutesNo obligation
Mailgun → TikTok · when not to buy
When you don't need this — Mailgun → TikTok
- Measure identifier coverage yourself first — pull your last hundred messages and count how many carry the ttclid.
- Deliverability monitoring is the right use of Mailgun's data. Attribution belongs at the order.
- If TikTok is a small share of spend, the effort is hard to justify. It pays when TikTok is a channel you are actively scaling.
Mailgun → TikTok · what we deliver
What gets built — Mailgun → TikTok
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 TikTok
Server events to the TikTok Events API with the ttclid, hashed contact information and a matching event_id.
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.
From $400 · See packages
FAQ
Mailgun → TikTok questions, answered
Store it server-side against the cart or customer on the first visit, then attach it to the order however they come back. Cookies in TikTok's in-app browser will not follow them into their mail app.
No. Send orders as CompletePayment; email clicks include automated scanners and say nothing about a purchase.
Almost always because the ttclid never reached the Mailgun message. No session, no click, and the trigger conditions are buried in application code rather than in a campaign tool. Measure coverage before debugging the dispatch.
The ttclid — TikTok's click identifier, appended to your landing page URL and also stored in the _ttp cookie. TikTok additionally matches on hashed email and phone. In-app browser behavior makes ttclid capture more fragile than the equivalents on other platforms, so persisting it server-side as soon as it is seen matters more here than elsewhere.
Your order system. Send orders. Use Mailgun events for deliverability monitoring only.
TikTok Events Manager shows received events and their match status. As with Meta, arriving is not the test — deduplicated and matched is. Reconcile TikTok's reported conversions against the source system for the same window.
More on Mailgun → TikTok
- TikTok · Lead → booked callHow to track lead to booked call for TikTok Ads
- TikTok · Booked call → closed wonHow to track booked call to closed won for TikTok Ads
- TikTok · Free trial → paidHow to track free trial to paid for TikTok Ads
RELATED GUIDES
Where Mailgun → TikTok fits in the rest of your tracking
- TikTok · SaaSTikTok Ads conversion tracking for SaaS companies
- TikTok · EcommerceTikTok Ads conversion tracking for ecommerce brands
- TikTok × SubscriptionsHow to reconcile TikTok Ads against your billing system
- TikTok · Signup → activationHow to track signup to product activation for TikTok Ads
- Postmark → TikTokConnecting Postmark to TikTok Events API
- Mailgun → NextdoorConnecting Mailgun to Nextdoor Ads
- EcommerceConversion tracking for ecommerce brands, measured against your orders
- Resend → TikTokConnecting Resend to TikTok Events API
Free · 30 min
Get Mailgun and TikTok joined properly
Free30 minutesNo obligation
