-
Notifications
You must be signed in to change notification settings - Fork 0
[CI] (bd5a2b4) next-js/15-pages-router-saas #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The files don't exist locally, so I need to evaluate this PR based on the diff provided. Let me analyze the diff thoroughly to provide a complete evaluation. PR Evaluation ReportSummaryThis PR integrates PostHog analytics into a Next.js 15 Pages Router SaaS application. It adds both client-side (
Confidence score: 4/5 👍
File changes
App sanity check: 4/5 ✅
Issues
|
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.333.0 and posthog-node@^5.24.1 in package.json |
| PostHog client initialized | Yes | Client-side via instrumentation-client.ts, server-side via singleton in lib/posthog-server.ts |
| capture() | Yes | 13+ distinct events captured across auth, billing, and team flows |
| identify() | Yes | Client-side in login.tsx, server-side in sign-in/sign-up/account-update APIs |
| Error tracking | Yes | captureException() used in catch blocks, capture_exceptions: true in client config |
| Reverse proxy | Yes | Properly configured in next.config.ts rewrites to /ingest path |
Issues
- Server-side flush missing: In serverless/edge environments, API routes may terminate before PostHog flushes events. Each API route should call
await posthog.flush()before returning. [MEDIUM] - Inconsistent distinctId strategy: Client uses email, server uses email, webhook uses Stripe customerId. Consider using a consistent user ID. [LOW]
- Server client host configuration: Uses
NEXT_PUBLIC_POSTHOG_HOSTbut this would behttps://us.posthog.comwhile client uses/ingestpath. Server should use direct PostHog URL. [LOW]
Other completed criteria
- API key loaded from environment variable (not hardcoded)
defaults: '2025-05-24'included in client configposthog.reset()called on logout (client-side)- Debug mode enabled in development
ui_hostproperly configured for reverse proxy setupcapture_exceptions: trueenabled for automatic error tracking
PostHog insights and events: 4/5 ✅
| Filename | PostHog events | Description |
|---|---|---|
components/header.tsx |
user_logged_out |
Client-side logout tracking before session clear |
components/login.tsx |
login_form_submitted, captureException |
Form submission with success/failure status and mode |
pages/api/auth/sign-in.ts |
user_signed_in, captureException |
Server-side login with team context |
pages/api/auth/sign-out.ts |
user_signed_out |
Server-side logout tracking |
pages/api/auth/sign-up.ts |
user_signed_up, captureException |
Signup with invitation vs direct source |
pages/api/account/update.ts |
account_updated |
Profile changes with before/after values |
pages/api/stripe/checkout.ts |
checkout_completed, captureException |
Subscription completion with plan details |
pages/api/stripe/create-checkout.ts |
checkout_started, captureException |
Checkout initiation funnel |
pages/api/stripe/customer-portal.ts |
customer_portal_opened |
Billing portal access |
pages/api/stripe/webhook.ts |
subscription_updated |
Subscription lifecycle changes |
pages/api/team/invite.ts |
team_member_invited |
Team growth tracking |
pages/api/team/remove-member.ts |
team_member_removed |
Team churn tracking |
pages/pricing.tsx |
pricing_plan_selected, captureException |
Pricing page conversion funnel |
Issues
- PII in event properties: Multiple events include raw email addresses as properties. PostHog best practice is to avoid PII in event properties and instead use person properties set via
identify(). [MEDIUM] - Missing page view auto-capture configuration: The
instrumentation-client.tsdoesn't explicitly configurecapture_pageview. While defaults may handle this, explicit configuration is preferred. [LOW]
Other completed criteria
- Events capture meaningful user actions (not just generic clicks)
- Events include relevant context properties (teamId, source, mode)
- Events support funnel analysis (checkout_started → checkout_completed)
- Events differentiate signup sources (invitation vs direct)
- Events include subscription status for cohort analysis
- Error tracking integrated at all critical failure points
- Events enable team analytics (invite/remove tracking)
Reviewed by wizard workbench PR evaluator
Automated wizard CI run
Source: manual
Trigger ID:
bd5a2b4App:
next-js/15-pages-router-saasApp directory:
apps/next-js/15-pages-router-saasWorkbench branch:
wizard-ci-bd5a2b4-next-js-15-pages-router-saasWizard branch:
mainExamples branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-01-21T21:09:49.713Z
Duration: 488.6s