Skip to main content
Xero → PostHogIntegration guide

Connecting Xero to PostHog

Xero holds the invoice and the reconciliation, which makes it the definitive revenue record for many service and trade businesses. 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 Xero invoice 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

Xero paid invoices in PostHog as company-level revenue

Map each Xero ContactID to a PostHog group key, then capture an invoice-paid event server-side with the group attached, subtotal and currency as properties, the Xero payment date as timestamp, and a UUID derived from the InvoiceID. Send it once under one deliberate distinct_id, usually the account owner, and send credit notes as a separate event.

PostHog's group analytics fits Xero better than person-level events do: a Xero contact is usually a company, and a paid invoice belongs to that company rather than to the person who signed up for your product. Map each Xero ContactID to the PostHog group key for the organization, then capture an invoice-paid event server-side with the group attached, the subtotal and currency as properties, and the timestamp set to the Xero payment date.

The event still needs a person's distinct_id, so choose one deliberately, usually the account owner, and send the invoice once. Sending it for every user in the company multiplies revenue in any insight that sums the property. Derive the event UUID from the Xero InvoiceID, so a reprocessed webhook does not create a duplicate on a self-hosted instance where nobody would notice.

This pairing answers product questions rather than advertising ones: which onboarding steps precede the first paid invoice, how long companies keep paying, which features paying companies use that others do not. Send credit notes as a separate event rather than negative revenue on the same name, so insights net them out explicitly. If invoices go out on thirty-day terms, funnels built on issue date will show conversion a month before the money.

Xero → PostHog · what breaks

Why this join usually fails — Xero → PostHog

  1. 01

    The distinct_id never reaches Xero

    Like any accounting system, Xero has no marketing context of its own. The identifier must be written onto the contact record by whatever creates it, and in many businesses that is a manual step which will be applied inconsistently unless it is automated.

  2. 02

    Payment terms separating the sale from the money

    An invoice issued in March and paid in May is one sale and two dates. Which one the conversion uses has to be a decision rather than an accident.

  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.

Xero → PostHog · the fix

What working looks like — Xero → PostHog

  • The distinct_id on every invoice

  • Conversions arriving in PostHog

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

  • Reconciled against the source

Xero → PostHog · architecture

How Xero and PostHog actually connect

  1. 1

    Xero holds the truth

    Xero's bank reconciliation is what makes it unusually trustworthy as a source of truth — an invoice marked paid and reconciled is money that actually arrived, which is a stronger guarantee than most systems offer.

  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 Xero invoice.

  4. 4

    The event source decides reliability

    Fire on payment, not on invoice issue. Trade businesses on thirty-day terms will otherwise report revenue a month before it exists.

  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.

Xero → PostHog · normal or broken

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

Normal, not a fault

  • The distinct_id present on the invoice

  • Sent from the Xero invoice payment webhook

  • 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

    Like any accounting system, Xero has no marketing context of its own. The identifier must be written onto the contact record by whatever creates it, and in many businesses that is a manual step which will be applied inconsistently unless it is automated.

  • Sent from the browser

    An invoice issued in March and paid in May is one sale and two dates. Which one the conversion uses has to be a decision rather than an accident.

  • 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

Xero → PostHog · diagnose

Diagnostic order — Xero → PostHog

  1. 01

    Count invoices carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Check whether the conversion fires on issue or on payment

    On terms-based businesses this single choice moves the numbers by a full billing cycle.

  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.

Xero → PostHog · prove

How it gets proven — Xero → PostHog

Source of truth

Xero's paid invoices by payment date, reconciled against the bank feed.

  • The distinct_id confirmed present on a live invoice.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • A paid invoice confirmed reconciled against the bank feed before being counted.

Xero → PostHog · free audit

What we check in the free audit

  • Count invoices carrying the distinct_id
  • Follow one real conversion end to end
  • Check whether the conversion fires on issue or on payment
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Xero's paid invoices by payment date, reconciled against the bank feed.

Get my free conversion tracking audit

Free30 minutesNo obligation

Xero → PostHog · when not to buy

When you don't need this — Xero → PostHog

  • Measure identifier coverage yourself first — pull your last hundred invoices and count how many carry the distinct_id.
  • If your work is paid at point of sale with no invoicing, the accounting system is not where the conversion should come from.
  • 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.

Xero → PostHog · what we deliver

What gets built — Xero → PostHog

  • Identifier capture into Xero

    Write the click identifier to a tracking category or a custom field on the Xero contact at creation, so subsequent invoices inherit the association.

  • Event source: the Xero invoice payment webhook

    Fire on payment, not on invoice issue. Trade businesses on thirty-day terms will otherwise report revenue a month before it exists.

  • 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

    Credit notes reverse against the original invoice and should reduce the reported figure.

Written guarantee

95%+ tracking accuracy

Measured against Xero's paid invoices by payment date, reconciled against the bank feed.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Xero → PostHog questions, answered

Capture a server-side event when Xero marks an invoice paid, with the company group attached, the payment date as the timestamp, and the account owner's distinct_id.

Free · 30 min

Get Xero and PostHog joined properly

Free30 minutesNo obligation