Testing and Troubleshooting

End-to-end validation and diagnosis for missing events, replays, Auth modal content, and Stats data

End-to-end smoke test

Use a new incognito window after every configuration or recorder deployment.

  1. Open /onboarding on the environment under test.
  2. Submit an initial prompt or link.
  3. Reach the sign-in step and open the Auth modal.
  4. Start signup, submit it, and complete email confirmation or Google auth.
  5. Complete onboarding and agent creation.
  6. Open the dashboard and copy the Z-Link.
  7. Create an external conversation and receive an Offer when available.
  8. Confirm structured events in PostHog Activity.
  9. Open the new Session Replay and verify the App and Auth modal.
  10. For Production, verify the same journey in Stats after its next refresh.

Expected funnel events include auth_signup_started, auth_signup_completed, z_agent_onboarding_building_completed, and z_agent_agent_created. App-side onboarding sign-in events do not replace Auth signup events.

Nothing appears in PostHog Activity

Check in this order:

  1. Confirm you are looking at the exact PostHog project whose token is configured in Vercel.
  2. Compare the token in both NEXT_PUBLIC_POSTHOG_PROJECT_KEY and POSTHOG_PROJECT_KEY with that project's token. Do not compare only the project ID.
  3. Confirm the ingestion host is https://us.i.posthog.com for the US project.
  4. Redeploy after any NEXT_PUBLIC_* change.
  5. In browser DevTools, verify PostHog ingestion requests are sent and not blocked by an extension, privacy browser, DNS filter, or ad blocker.
  6. Remove PostHog UI filters and widen the time range.
  7. Check environment = development or environment = production explicitly.
  8. Inspect the Zooly journey_event row. If it exists without posthog_delivered_at, diagnose server delivery or retry configuration.

A wrong but valid project token is a common failure: the application works and requests can succeed, but the data is written to a different project.

Activity appears but Session Replay does not

  • Confirm Record user sessions is enabled.
  • Confirm the public token exists in the deployed browser bundle.
  • Verify the sanitized $pageview event has replay_anchor = true and a $session_id.
  • Check recording conditions, sampling, minimum duration, and URL blocklist.
  • Disable local ad blockers for the test.
  • Create a new session; old sessions cannot be reconstructed.
  • Allow a short processing delay, then refresh Replay.

Auth modal is missing from Replay

The modal is a cross-origin iframe, not part of the parent App DOM. Verify:

  1. App and Auth both contain the current @zooly/consent build.
  2. recordCrossOriginIframes is enabled in both documents.
  3. App and Auth use the same NEXT_PUBLIC_POSTHOG_PROJECT_KEY and host.
  4. Auth has been redeployed after the public-variable change.
  5. The iframe loads a supported Auth origin and is not sandboxed in a way that prevents its recorder.
  6. A completely new recording was created after both deployments.

If App content records but Auth does not, inspect network requests from inside the iframe separately in DevTools.

PostHog works in Dev but not Production

Compare the deployed Production project, not the local or Dev settings:

  • public and server project token
  • public and server host
  • NEXT_PUBLIC_JOURNEY_ENVIRONMENT=production
  • JOURNEY_ENVIRONMENT=production
  • Production redeploy timestamp after variable changes
  • App/Auth token equality
  • Production Auth ingest URL/secret pair

Do not copy a Dev-only token from a different PostHog project. The intended design uses one shared project token and separates traffic with environment.

Production events appear in PostHog but not Stats

Stats does not read PostHog. Verify:

  1. The journey was performed on app.zooly.ai.
  2. The first-party event reached the Production journey_event table.
  3. The persisted row has environment = 'production'.
  4. zooly-stats has the correct READ_ONLY_PROD_DB.
  5. The account is not deleted, and the selected QA data mode includes the journey. The default excludes zQA; use Only zQA or Include all to inspect tests.
  6. The signed-in Stats user has the admin role.
  7. The period and account/agency filter include the journey.

Dev and Stage database rows are intentionally absent from the executive dashboard.

Signup started/completed is missing

  • auth_signup_started is captured once when a signup modal becomes visible, the user switches into signup, or starts email/social signup.
  • Stats also rolls up auth_signup_submitted and z_agent_onboarding_signin_clicked, so a delivered server event or the same-origin modal-open event prevents a completed signup from appearing without a start.
  • auth_signup_completed is emitted by the confirmation endpoint after successful confirmation.
  • The App must pass journey context into Auth.
  • Auth must resolve the matching Dev or Production ingest target.
  • The Auth target secret must equal the App's JOURNEY_EVENT_INGEST_SECRET.
  • For social auth, expect auth_social_login_completed; determine separately whether the product treats a first-time social user as signup for funnel reporting.

Inspect Auth logs for [auth-journey] warnings when origin routing or ingest variables are missing.

Stats requires all replay metadata:

  • consent version 2
  • replay consent flag true
  • a PostHog session recording ID
  • POSTHOG_PROJECT_URL on Stats

If any required value is absent, hiding Replay is expected behavior.