PostHog Handbook Library / Support

766 words. Estimated reading time: 4 min.

Troubleshooting tips

A collection of tips & tricks on helping to troubleshoot customer issues.

General

Feature flags

Funnels

Common funnel troubleshooting steps

Connecting frontend and backend identities

To connect frontend and backend identities, you only need to use the same distinct_id in both frontend and backend events. How you sync these depends on your system but here are some ways:

Recommended: Set the distinct_id based on a known user ID: If you have a stable internal user ID, set posthog.identify('your-user-id') on the frontend, and use that same ID in backend events. This ensures alignment across both environments

Use a signed token or cookie: Store the distinct_id in a cookie or session token shared between frontend and backend, especially if you're using server-side rendering or middleware that handles both sides.

Pass the ID from frontend to backend: When a user logs in or performs a tracked action, capture their distinct_id in the frontend (e.g., using posthog.get_distinct_id()), then include it in API requests or session headers so your backend can reuse it when sending events. Careful, you’re relying on PostHog’s distinct_id here, which may not be an expected value.

A potential pitfall is posthog.reset().

Canonical URL: https://posthog.com/handbook/support/troubleshooting-tips

GitHub source: contents/handbook/support/troubleshooting-tips.md

Content hash: 5b4c0ea84f37f642