Repository navigation
[CI] (8dccaac) next-js/15-pages-router-saas - #2359
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
wizard-ci-bot[bot] wants to merge 1 commit into
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog into a Next.js 15 Pages Router SaaS application with both client-side (
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | No syntax errors, all imports valid, TypeScript types correct |
| Preserves existing env vars & configs | Yes | Existing next.config.ts extended with rewrites; webhook handler restructured but functionality preserved |
| No syntax or type errors | Yes | All code is syntactically valid TypeScript/TSX |
| Correct imports/exports | Yes | posthog-js imported client-side, posthog-node server-side, no cross-environment contamination |
| Minimal, focused changes | Yes | All changes directly related to PostHog integration |
| Pre-existing issues | None | — |
Issues
- Environment variables not documented:
NEXT_PUBLIC_POSTHOG_PROJECT_TOKENandNEXT_PUBLIC_POSTHOG_HOSTare required but not added to any.env.examplefile. The setup report acknowledges this as a TODO. [LOW]
Other completed criteria
- App builds without errors — no missing dependencies or invalid syntax
- Build configuration valid —
package.jsondependencies properly added - Existing functionality preserved — webhook handler logic unchanged, just wrapped in block scopes
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.396.5 and posthog-node@^5.39.4 in package.json |
| PostHog client initialized | Yes | instrumentation-client.ts uses posthog.init() with env vars, correct for Next.js 15+ |
| capture() | Yes | 13 meaningful events across client and server |
| identify() | No | Uses raw email addresses as distinct_id instead of stable user IDs |
| Error tracking | Yes | capture_exceptions: true in init config enables automatic exception capture |
| Reverse proxy | Yes | Next.js rewrites properly configured: /ingest/static/* and /ingest/array/* → us-assets.i.posthog.com, /ingest/* → us.i.posthog.com |
Issues
- Email used as distinct_id:
posthog.identify(data.email, { email: data.email })on the client andposthog.identify({ distinctId: foundUser.email, ... })on the server both use the user's email as their distinct ID. Emails can change, and using them as the primary identifier causes fragmented user profiles. UsefoundUser.id.toString()(or equivalent stable database ID) as the distinct_id, and pass email only as a person property. [MEDIUM] - No re-identification for returning sessions: Users who return with an active session cookie (visiting
/dashboarddirectly) remain on their anonymous distinct ID until they explicitly sign in again. Consider callingposthog.identify()when the/api/userSWR response resolves with a known user. [LOW]
Other completed criteria
- API key loaded from
NEXT_PUBLIC_POSTHOG_PROJECT_TOKENenvironment variable - API host correctly configured via reverse proxy (
/ingest) ui_hostset tohttps://us.posthog.comfor toolbar access through proxyposthog.reset()called on sign-out- Server-side client uses singleton pattern with proper flush settings
skipTrailingSlashRedirect: trueadded for proxy compatibility
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
pages/pricing.tsx |
pricing_page_viewed, checkout_started |
Top-of-funnel: tracks pricing page views and checkout initiation with plan details |
components/header.tsx |
user_signed_out |
Captures sign-out with posthog.reset() to unlink future events |
components/login.tsx |
identify |
Identifies user on sign-in/sign-up (client-side) |
pages/dashboard/index.tsx |
manage_subscription_clicked, team_member_removed, team_member_invite_submitted |
Dashboard engagement events with relevant properties |
pages/dashboard/general.tsx |
account_updated |
Tracks account settings changes |
pages/api/auth/sign-in.ts |
user_signed_in |
Server-side sign-in with team_id property |
pages/api/auth/sign-up.ts |
user_signed_up |
Server-side sign-up with team_id and via_invite properties |
pages/api/stripe/create-checkout.ts |
checkout_session_created |
Server-side Stripe checkout creation with price_id |
pages/api/stripe/webhook.ts |
subscription_updated, subscription_cancelled |
Server-side webhook events for subscription lifecycle |
pages/api/team/invite.ts |
team_member_invitation_sent |
Server-side team invitation tracking |
Issues
- No critical or medium issues with event quality.
Other completed criteria
- Events represent real user actions across the full SaaS lifecycle
- Events enable product insights — checkout conversion funnel, signup trends, subscription churn analysis
- Events include enriched properties (plan_name, price_id, team_id, role, status, interval)
- No PII in event properties — emails only in identify calls, not in capture properties
- Consistent snake_case naming convention across all events
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: wizard-pr
Trigger ID:
8dccaacApp:
next-js/15-pages-router-saasApp directory:
apps/next-js/15-pages-router-saasWorkbench branch:
wizard-ci-8dccaac-next-js-15-pages-router-saasWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-07-03T00:40:05.325Z
Duration: 584.2s
YARA Scanner