Skip to main content
SendGrid → PostHogIntegration guide

Connecting SendGrid to PostHog

SendGrid carries both transactional and marketing mail through one account, which is convenient operationally and the source of the measurement problem: only one of those two streams has anything to do with acquisition. PostHog can be self-hosted, which changes the calculus entirely: the data stays on infrastructure you control, and so does the responsibility for everything that goes wrong with it. The join between them succeeds or fails on one thing: whether the distinct_id reaches the SendGrid send before the conversion happens, because PostHog can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

SendGrid events in PostHog: joined on the same distinct_id

Join SendGrid to PostHog on distinct_id: pass your user ID in SendGrid custom arguments and forward delivered, clicked, unsubscribed and bounced Event Webhook events through the capture API with template or campaign name. Use SendGrid's event ID as the PostHog event UUID to drop retries. Leave out opens, filter scanner clicks, and keep transactional mail as a separate event.

PostHog shows what users do in your product; SendGrid knows which emails they received and clicked. Joining them lets you answer a question neither can alone: did the onboarding email about a feature lead to people using it? The join key is PostHog's distinct_id. Put your user ID, the same one you use as the distinct_id, into SendGrid's custom arguments on each send, and it comes back on every Event Webhook event.

Forward a small set of those events into PostHog through the capture API: delivered, clicked, unsubscribed and bounced, each carrying the template or campaign name. Leave out opens, which mail privacy features prefetch, and filter clicks that arrive within seconds of delivery, which are often security scanners rather than people. Use SendGrid's event ID as the PostHog event UUID so webhook retries do not create duplicates.

Then build the funnel in PostHog: email delivered, email clicked, feature used, upgraded. Keep transactional emails as a separate event name or property so a password reset click does not look like engagement with a lifecycle campaign. On a self-hosted instance, remember that SendGrid retries webhook deliveries that fail, so an ingestion outage produces a late burst rather than a clean gap.

SendGrid → PostHog · what breaks

Why this join usually fails — SendGrid → PostHog

  1. 01

    The distinct_id never reaches SendGrid

    Marketing clicks land with tracking parameters; transactional clicks generally do not, and both arrive on the same domain.

  2. 02

    Receipt clicks credited to email marketing

    A customer clicking through their own order confirmation to check delivery is not an email marketing conversion. Untagged transactional traffic pooled with marketing makes the channel look far better than it is.

  3. 03

    Self-hosting the analytics and the outage together

    The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  4. 04

    Nothing reconciles afterwards

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

SendGrid → PostHog · the fix

What working looks like — SendGrid → PostHog

  • The distinct_id on every message

  • Conversions arriving in PostHog

    The event lands on the person profile and becomes available in insights, funnels and session replay.

  • Reconciled against the source

SendGrid → PostHog · architecture

How SendGrid and PostHog actually connect

  1. 1

    SendGrid holds the truth

    A receipt and a promotional campaign are both an email in the same account. Only the campaign can plausibly have caused a purchase, and only if the purchase carries the campaign's identifier.

  2. 2

    PostHog needs a click to match

    PostHog needs a distinct_id, an event name and its properties. Self-hosted instances additionally need the ingestion endpoint reachable and the project API key correct, which is a class of failure hosted tools do not have.

  3. 3

    The identifier is the bridge

    The distinct_id, captured at the visit and carried into the SendGrid send.

  4. 4

    The event source decides reliability

    Send orders with the marketing campaign attributed where a tagged click preceded them.

  5. 5

    Deduplication at the destination

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

SendGrid → PostHog · normal or broken

Working vs. broken, side by side — SendGrid → PostHog

Normal, not a fault

  • The distinct_id present on the message

  • Sent from your order system

  • Deduplicated correctly

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

  • Reconciles with the source

Actually broken

  • The distinct_id missing on most records

    Marketing clicks land with tracking parameters; transactional clicks generally do not, and both arrive on the same domain.

  • Sent from the browser

    A customer clicking through their own order confirmation to check delivery is not an email marketing conversion. Untagged transactional traffic pooled with marketing makes the channel look far better than it is.

  • Counted twice, or not at all

    The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  • Nobody has reconciled it

SendGrid → PostHog · diagnose

Diagnostic order — SendGrid → PostHog

  1. 01

    Count messages carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Check whether transactional links carry campaign parameters

    If they do, every receipt click is being credited to email and the channel's reported performance is inflated.

  4. 04

    Check ingestion health and disk before debugging any missing event

    On self-hosted instances the answer is infrastructure far more often than it is instrumentation.

  5. 05

    Read the match rate, not the success message

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

SendGrid → PostHog · prove

How it gets proven — SendGrid → PostHog

Source of truth

Your order system, with marketing sends distinguished from transactional ones.

  • The distinct_id confirmed present on a live message.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • Orders from tagged marketing clicks reconciled against imported conversions, with transactional traffic excluded.

SendGrid → PostHog · free audit

What we check in the free audit

  • Count messages carrying the distinct_id
  • Follow one real conversion end to end
  • Check whether transactional links carry campaign parameters
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Your order system, with marketing sends distinguished from transactional ones.

Get my free conversion tracking audit

Free30 minutesNo obligation

SendGrid → PostHog · when not to buy

When you don't need this — SendGrid → PostHog

  • Measure identifier coverage yourself first — pull your last hundred messages and count how many carry the distinct_id.
  • If you send only transactional mail, there is no marketing channel here to measure.
  • If you have no reason to keep the data on your own infrastructure and no team to run it, the hosted product removes the only real downside of this one.

SendGrid → PostHog · what we deliver

What gets built — SendGrid → PostHog

  • Identifier capture into SendGrid

    Tag marketing links explicitly and attribute purchases from those; treat transactional traffic as returning customers, not as a channel.

  • Event source: your order system

    Send orders with the marketing campaign attributed where a tagged click preceded them.

  • Dispatch to PostHog

    The PostHog capture API, posted server-side from your backend to your own instance or to PostHog Cloud.

  • Reversals where they exist

    Refunds reverse.

Written guarantee

95%+ tracking accuracy

Measured against Your order system, with marketing sends distinguished from transactional ones.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

SendGrid → PostHog questions, answered

Pass your user ID in SendGrid custom arguments, then forward Event Webhook events to the PostHog capture API with that ID as the distinct_id.

Free · 30 min

Get SendGrid and PostHog joined properly

Free30 minutesNo obligation