Webclat / PostHog Practice

The mechanics of getting an event into PostHog correctly the first time

Most event-quality problems trace back to how the event was sent, not what PostHog did with it afterward. Understanding the ingestion pipeline - and the difference between a personal API key, a project API key, and the JavaScript SDK's own capture method - prevents most of them.

How PostHog actually processes an event you send

At a high level: an event is sent (via SDK or direct API call) with a project identifier, is queued for ingestion, gets processed against any configured transformations or person-property updates, and is persisted for query. Knowing this pipeline exists matters practically for one reason: there is a delay between sending and queryability, and a malformed event can fail silently at more than one stage depending on what exactly is wrong with it.

API keys: project versus personal, and why the distinction matters

  • Project API key - used by SDKs and the capture API to send events into a specific project. This is what belongs in client-side code (it is designed to be public-facing) and what identifies which project an event lands in.
  • Personal API key - used for authenticated access to PostHog's management and query APIs (reading data, managing flags, admin actions). This should never end up in client-side code - it carries account-level permissions, not just "send an event to this project" scope.

Confusing the two is a real, recurring mistake: a personal API key exposed in a frontend bundle is a credential leak, not a minor misconfiguration.

Sending events: SDK versus raw API

ApproachWhen it's the right call
JavaScript SDK capture()Standard client-side tracking - handles session/person context, batching, and retry behavior for you
Server-side SDKsEvents that should not depend on the client (billing events, backend-triggered actions) or where you need guaranteed delivery independent of the browser
Direct capture API callEnvironments without an official SDK, or custom pipelines where you are already managing batching/retry yourself

Schema management: naming discipline before volume, not after

"How Posthog works" as a pipeline is the mechanical half of this; the other half is the same discipline covered in the autocapture-vs-explicit-events guide - a documented naming convention for events and properties, enforced before volume makes cleanup expensive. Schema management tooling helps enforce this once it exists, but it does not create the convention for you.

How to verify it worked

  1. Send a test event and confirm it appears in PostHog's live events view within the expected ingestion delay - if it never appears, check the API key type and project match before assuming a code bug.
  2. Confirm the event carries the properties you expect, correctly typed - a string sent where PostHog expects a number (or vice versa) can silently break downstream filtering even though the event itself ingested successfully.
  3. For server-side sends, confirm delivery does not silently fail on network errors - check whatever retry/error-handling the SDK or your own integration provides, rather than assuming "sent" means "arrived."
  4. Audit that no personal API key appears anywhere in client-side/browser-loaded code - a quick search of your shipped JavaScript bundle for the key prefix is a five-minute check worth doing once.

Frequently Asked Questions

Why did my event not show up in PostHog?

Check, in order: the API key is a project key (not a personal key) and matches the intended project; the event payload is valid JSON with the expected required fields; and enough time has passed for ingestion delay. Most "missing event" cases are one of these three, not a PostHog outage.

Should backend events use the same schema as frontend events?

They should share the same naming convention and property taxonomy so they are queryable together - but backend events are also where you can guarantee delivery and avoid the ad-blocker/ITP loss that affects client-side capture, which makes them the right home for anything business-critical.

Do you help design the event schema itself, not just fix sending mechanics?

Yes - schema and naming-convention design is core event-architecture work, and it is usually the more valuable half of getting this right; the API mechanics on this page are the part that breaks visibly, but a bad taxonomy is the part that costs more later.

Get your event schema designed before volume makes it expensive to fix.

We set naming conventions, key scoping, and client/server split before instrumentation ships - not after six months of inconsistent event names.

Design My Event Schema