Documentation

PostHog

Choose web analytics, product events, errors, logs, and request traces.

Enable PostHog

Use PostHog starts on in the project generator, with all five capabilities selected. Uncheck any you do not need. Keep at least one selected, or turn PostHog off.

Your choices become the default Cargo features in app/Cargo.toml and are recorded in .shiprust.toml. PostHog is independent of Sentry.

Choose capabilities

  • Web analytics (posthog-web): browser pageviews, pageleaves, and Core Web Vitals.
  • Product events (posthog-product): successful sign-up, sign-in, and sign-out events, plus user profiles with UUID, email, and account creation date.
  • Error tracking (posthog-errors): browser exceptions, server errors, and best-effort panic reporting.
  • Application logs (posthog-logs): batched structured Rust logs.
  • Request traces (posthog-traces): sampled HTTP request spans with trace context propagation.

Configure your project

Set your own project's public ingestion token in .env locally and in your deployment environment:

POSTHOG_PROJECT_TOKEN=your-project-ingestion-token
POSTHOG_HOST=https://us.i.posthog.com
POSTHOG_TRACE_SAMPLE_RATIO=0.1

For an EU project, use https://eu.i.posthog.com. Use an ingestion token, not a personal API key. The generator never asks for credentials. A blank token disables all PostHog exports and browser SDK loading.

POSTHOG_TRACE_SAMPLE_RATIO accepts 0 through 1 and defaults to 0.1 for new request traces. Valid upstream sampling decisions are respected. Logs and errors are independent of trace sampling.

Know what is collected

Browser analytics loads asynchronously, with no JavaScript build step. Replay, autocapture, heatmaps, surveys, and feature flags are disabled. Browser and server identity use the account UUID; product events intentionally include account email.

Server telemetry omits passwords, cookies, request bodies, query strings, and raw unmatched paths. Your custom error messages and log fields may still contain application data. Health checks and static assets are excluded from request telemetry.

Change the choice later

Add or remove the five posthog-* capabilities listed above in the default features in app/Cargo.toml, then rebuild. Removing all five omits the PostHog integration. To try additional capabilities locally:

cargo run --features posthog-web,posthog-errors

This adds capabilities to the existing defaults. See the generated README for custom event helpers and local telemetry tests.