Shipr uses PostHog for product analytics, routed through a Next.js reverse proxy to avoid ad-blockers.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/egeuysall/shipr/llms.txt
Use this file to discover all available pages before exploring further.
Quick Start
Get PostHog API Key
Sign up at posthog.com and create a new project. Copy your project API key from the settings page.
Architecture
Three components handle analytics in the root layout:| Component | File | Purpose |
|---|---|---|
PostHogProvider | src/components/posthog-provider.tsx | Initializes the PostHog client and wraps the app |
PostHogPageview | src/components/posthog-pageview.tsx | Captures $pageview on route changes |
PostHogIdentify | src/components/posthog-identify.tsx | Links Clerk user identity to PostHog person |
PostHog Provider
The provider initializes the PostHog client on the client side:src/components/posthog-provider.tsx
capture_pageview is set to false because pageviews are captured manually by PostHogPageview to work correctly with Next.js App Router navigation.Reverse Proxy Setup
PostHog requests are proxied through Next.js rewrites to bypass ad-blockers. This is configured innext.config.ts:
next.config.ts
/ingest/static/*tohttps://us-assets.i.posthog.com/static/*/ingest/*tohttps://us.i.posthog.com/*
User Identification
ThePostHogIdentify component automatically identifies users when they sign in with Clerk:
src/components/posthog-identify.tsx
posthog.reset() to clear the person profile.
Tracked Events
Shipr tracks the following events out of the box:| Event | Location | Description |
|---|---|---|
$pageview | posthog-pageview.tsx | Every route change |
cta_clicked | Hero, CTA sections | User clicked a call-to-action button |
pricing_plan_clicked | Pricing section | User selected a pricing plan |
upgrade_button_clicked | Dashboard | User clicked upgrade |
faq_expanded | FAQ section | User opened a FAQ item |
navigation_clicked | Header | Nav link clicked (includes device type) |
mobile_menu_toggled | Header | Mobile menu opened/closed |
theme_toggled | Theme toggle | Theme changed (includes previous/new theme) |
Capturing Custom Events
Capture custom events anywhere in your app:Keep event names in
snake_case and include relevant context as properties.Environment Variables Reference
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_POSTHOG_KEY | Yes | Your PostHog project API key (starts with phc_) |
NEXT_PUBLIC_POSTHOG_HOST | Yes | PostHog API host (usually https://us.i.posthog.com) |