-
Notifications
You must be signed in to change notification settings - Fork 0
[CI] (afd8cc2) next-js/15-pages-router-saas #207
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
|
Now I have read all the changed files. Let me compile the PR evaluation report. PR Evaluation ReportSummaryThis PR adds a comprehensive PostHog integration to a Next.js 15 Pages Router SaaS application. It includes client-side initialization via
Confidence score: 3/5 🤔
File changes
App sanity check: 4/5 ✅
Issues
|
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js ^1.325.0 and posthog-node ^5.21.0 in dependencies |
| PostHog client initialized | Yes | Client via instrumentation-client.ts, server via singleton in lib/posthog-server.ts |
| capture() | Yes | Multiple events captured across client and server |
| identify() | Yes | User identification on login, signup, and account update |
| Error tracking | Yes | capture_exceptions: true and captureException() calls |
| Reverse proxy | Yes | Correctly configured in next.config.ts rewrites |
Issues
- Server-side events may not flush: API routes don't await
posthog.shutdown()or explicit flush. In serverless environments, events may be lost when the function terminates. Should callawait posthog.shutdown()before returning responses in API routes. [CRITICAL] - Host mismatch between client and server: Client uses
/ingestproxy, server usesNEXT_PUBLIC_POSTHOG_HOSTdirectly. Server events bypass the proxy, potentially causing ad-blocker issues for server-initiated events viewed in same session. [MEDIUM] - Webhook identity disconnection: Stripe webhook uses
subscription.customer(Stripe customer ID likecus_xxx) as distinctId instead of user email, making these events appear as separate users in PostHog. [MEDIUM] - No explicit pageview tracking: The client init doesn't set
capture_pageview- default may not capture SPA navigation in Pages Router correctly. [LOW]
Other completed criteria
- Uses latest
defaults: '2025-05-24'for modern PostHog behavior - Debug mode enabled in development
posthog.reset()called on sign-out- Proper singleton pattern for server client to avoid multiple instances
flushAt: 1andflushInterval: 0configured for immediate flushing (good for serverless)
PostHog insights and events: 4/5 ✅
| Filename | PostHog events | Description |
|---|---|---|
components/header.tsx |
signed_out |
Tracks user logout for session analytics |
components/login.tsx |
captureException |
Error tracking for login failures |
pages/pricing.tsx |
checkout_started, captureException |
Tracks checkout funnel entry with plan details |
pages/api/auth/sign-in.ts |
signed_in |
Auth event with team context |
pages/api/auth/sign-up.ts |
signed_up |
Registration event with invite tracking |
pages/api/stripe/checkout.ts |
checkout_completed |
Subscription activation with plan details |
pages/api/stripe/create-checkout.ts |
checkout_session_created |
Checkout initiation server-side |
pages/api/stripe/customer-portal.ts |
customer_portal_opened |
Billing management access |
pages/api/stripe/webhook.ts |
subscription_updated, subscription_canceled |
Subscription lifecycle events |
pages/api/team/invite.ts |
team_member_invited |
Team growth tracking |
pages/api/team/remove-member.ts |
team_member_removed |
Team churn tracking |
pages/api/account/update.ts |
account_updated |
Profile changes tracking |
Issues
- Webhook events disconnected from user identity:
subscription_updatedandsubscription_canceleduse Stripe customer ID as distinctId. To build proper subscription funnels, these need to be linked to user email. Consider looking up user by Stripe customer ID. [MEDIUM]
Other completed criteria
- Events cover full user lifecycle (signup → checkout → subscription → churn)
- Rich event properties enable segmentation (plan name, team ID, role)
- Team collaboration events enable growth analytics
- Invited signup tracking enables referral/viral analysis
- Exception capture enables error correlation with user journeys
Reviewed by wizard workbench PR evaluator
Automated wizard CI run
Source: manual
Trigger ID:
afd8cc2App:
next-js/15-pages-router-saasApp directory:
apps/next-js/15-pages-router-saasWorkbench branch:
wizard-ci-afd8cc2-next-js-15-pages-router-saasWizard branch:
mainExamples branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-01-16T14:02:06.346Z
Duration: 462.1s