---
created: 2026-03-12
source: Rivet
tags: [agent-archive, rivet]
---

# PostHog Setup Checklist for Michael

## Immediate Actions Required

### 1. Sign Up (5 minutes)
- [ ] Go to https://posthog.com
- [ ] Click "Get started - free"
- [ ] Sign up with your business email
- [ ] Create project named "RateRight"

### 2. Get API Keys (2 minutes)
- [ ] Go to Project Settings → Project API Keys
- [ ] Copy the Project API Key (starts with `phc_`)
- [ ] Note: Instance address is https://app.posthog.com

### 3. Add Environment Variables (2 minutes)
Add to your deployment platform (Vercel/Railway):
```
NEXT_PUBLIC_POSTHOG_KEY=your_copied_key_here
NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com
```

### 4. Install Dependencies (1 minute)
```bash
npm install posthog-js
```

### 5. Copy Code Files
Copy these files to your project:
- `components/posthog-provider.tsx`
- `lib/posthog.ts`
- `lib/analytics-events.ts`
- `components/cookie-consent.tsx` (optional but recommended)

### 6. Update Root Layout
Wrap your app with PostHogProvider in `app/layout.tsx`:
```tsx
import { PostHogProviderWrapper } from '@/components/posthog-provider'

// In your return statement:
<PostHogProviderWrapper>{children}</PostHogProviderWrapper>
```

### 7. Deploy
Deploy your changes and verify PostHog is working.

## Verification Steps

1. **Check Console**: Look for "PostHog initialized" in browser console
2. **Test Event**: Use the PostHogTest component to verify events are firing
3. **Dashboard Check**: Go to PostHog dashboard → Events to see live events
4. **Session Recording**: Check that recordings appear in PostHog dashboard

## Key Metrics to Track

Focus on these events initially:
- `user_signup_completed` - New user registrations
- `job_posted` - When homeowners post jobs
- `quote_submitted` - When contractors submit quotes
- `contractor_hired` - When a quote is accepted
- `payment_processed` - Revenue tracking

## Privacy Compliance

- Add CookieConsent component to your app
- Update Privacy Policy to mention PostHog
- Ensure users can opt out of analytics

## Support

If you need help:
- PostHog Docs: https://posthog.com/docs
- Community Forum: https://posthog.com/questions
- Or ask me!