[CI] (7f79337) next-js/15-pages-router-saas#334
Closed
wizard-ci-bot[bot] wants to merge 1 commit intomainfrom
Closed
[CI] (7f79337) next-js/15-pages-router-saas#334wizard-ci-bot[bot] wants to merge 1 commit intomainfrom
wizard-ci-bot[bot] wants to merge 1 commit intomainfrom
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog analytics into a Next.js 15 Pages Router SaaS application. It adds both client-side (
Confidence score: 3/5 🤔
File changes
App sanity check: 4/5 ✅
Issues
|
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.347.0 and posthog-node@^5.24.15 in package.json |
| PostHog client initialized | Yes | Client via instrumentation-client.ts, server via singleton in lib/posthog-server.ts |
| capture() | Yes | Extensive event capture across auth, payments, teams |
| identify() | Partial | Server-side uses user ID, client-side incorrectly uses email |
| Error tracking | Yes | captureException() used in all error handlers; capture_exceptions: true enabled |
| Reverse proxy | Yes | Correct rewrites in next.config.ts with skipTrailingSlashRedirect |
Issues
- Identity mismatch between client and server: Client-side
posthog.identify(data.email, {...})inlogin.tsxuses the user's email as the distinct ID, while server-side usesuser.id.toString(). This will create separate user profiles in PostHog. Should use the same identifier (user ID) on both client and server. [CRITICAL] - Webhook distinct_id uses Stripe customer ID: In
webhook.ts, events usesubscription.customeras the distinct ID instead of the actual user ID. This breaks user analytics correlation. Should look up the user from the team's Stripe customer ID. [MEDIUM] - Server-side PostHog client not awaited: The
posthog.capture()andposthog.identify()calls are not awaited, and withflushAt: 1, flushInterval: 0, events may be lost if the function returns before flush completes. [MEDIUM] - Email included in event properties: Multiple events include
emailin properties, which is PII and should be avoided or anonymized. [LOW]
Other completed criteria
- API key via environment variable (not hardcoded)
- Correct US API host configuration
posthog.reset()called on logoutcapture_exceptions: truefor automatic error trackingdebugmode enabled only in development
PostHog insights and events: 4/5 ✅
| Filename | PostHog events | Description |
|---|---|---|
components/login.tsx |
user_logged_in, user_signed_up, captureException |
Tracks successful client-side auth with email property |
components/header.tsx |
user_logged_out, captureException |
Tracks logout with PostHog reset for session end |
pages/pricing.tsx |
pricing_plan_clicked, captureException |
Tracks pricing intent with plan details (name, price, interval) |
pages/api/auth/sign-in.ts |
user_signed_in, identify, captureException |
Server-side signin with team context |
pages/api/auth/sign-up.ts |
user_signed_up, identify, captureException |
Server-side signup with invite/team tracking |
pages/api/auth/sign-out.ts |
user_signed_out |
Server-side signout |
pages/api/stripe/create-checkout.ts |
checkout_started, captureException |
Payment funnel entry point with priceId |
pages/api/stripe/checkout.ts |
checkout_completed, captureException |
Payment success with plan, subscription, customer details |
pages/api/stripe/webhook.ts |
subscription_updated, subscription_cancelled |
Stripe lifecycle events for churn analysis |
pages/api/stripe/customer-portal.ts |
customer_portal_accessed, captureException |
Billing intent tracking |
pages/api/team/invite.ts |
team_member_invited, captureException |
Team growth tracking with invited role |
pages/api/team/remove-member.ts |
team_member_removed, captureException |
Team churn tracking |
pages/api/account/update.ts |
account_updated, identify, captureException |
Profile update tracking with field info |
Issues
- Duplicate client/server events: Having both
user_logged_in(client) anduser_signed_in(server) for the same action creates confusion. Should use one source of truth. [LOW] - Missing page view tracking verification: While
instrumentation-client.tsinitializes PostHog, there's no explicitcapture_pageviewsetting. Default behavior should work but is not verified. [LOW]
Other completed criteria
- Events capture real user actions across full product lifecycle
- Signup → Checkout funnel fully instrumented
- Subscription lifecycle (update/cancel) captured from webhooks
- Team collaboration events (invite/remove) captured
- Properties enriched with teamId, priceId, planName, etc.
- Exception capture throughout for error monitoring
Reviewed by wizard workbench PR evaluator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated wizard CI run
Source: context-mill-pr
Trigger ID:
7f79337App:
next-js/15-pages-router-saasApp directory:
apps/next-js/15-pages-router-saasWorkbench branch:
wizard-ci-7f79337-next-js-15-pages-router-saasWizard branch:
mainContext Mill branch:
clarify-next-providerPostHog (MCP) branch:
masterTimestamp: 2026-02-12T21:07:20.471Z
Duration: 808.7s