Skip to content

[CI] (137243f) astro/astro-hybrid-marketing - #1960

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-137243f-astro-astro-hybrid-marketing
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-137243f-astro-astro-hybrid-marketing

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 137243f
App: astro/astro-hybrid-marketing
App directory: apps/astro/astro-hybrid-marketing
Workbench branch: wizard-ci-137243f-astro-astro-hybrid-marketing
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-06-18T16:11:30.437Z
Duration: 390.1s

@wizard-ci-bot

wizard-ci-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into an Astro hybrid marketing site (NeuralFlow AI) using both a client-side HTML snippet (posthog.astro component) and a server-side posthog-node singleton for API route tracking. It adds 10 custom events across hero CTAs, navigation, pricing, and a contact form flow with client-server session continuity via custom headers.

Files changed Lines added Lines removed
11 +182 -7

Confidence score: 4/5 👍

  • Email used as distinct_id: Both client-side identify(data.email, ...) and server-side posthog.identify({ distinctId: data.email }) use the raw email as the distinct ID. This creates fragmented user profiles since the browser's anonymous ID won't merge correctly with an email string. The server should use the X-PostHog-Distinct-Id header it already receives, and the client should use a stable user ID (not email). [CRITICAL]
  • No reverse proxy configured: The client-side snippet sends events directly to PostHog without a reverse proxy, making tracking vulnerable to ad blockers. [MEDIUM]
  • No .env.example committed: Environment variables PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST are only added to .env (which is gitignored). No .env.example or equivalent is committed to document required variables for collaborators. [MEDIUM]

File changes

Filename Score Description
src/components/posthog.astro 4/5 New PostHog client snippet component using is:inline and define:vars for env injection. Uses older snippet version (missing -assets domain rewrite).
src/layouts/Layout.astro 5/5 Imports and renders PostHog component in <head> — correct placement.
src/lib/posthog-server.ts 4/5 Singleton server-side PostHog client with shutdown helper. Uses PUBLIC_ env var which works but is unconventional for server-side secrets.
src/pages/api/contact.ts 2/5 Server-side contact form tracking with session continuity headers. Uses email as distinct_id instead of the client-provided distinct_id header.
src/pages/contact.astro 3/5 Client-side form tracking with identify, capture, and captureException. Uses email as distinct_id in identify call.
src/pages/index.astro 5/5 Click tracking on hero CTAs with location property.
src/pages/pricing.astro 5/5 Page view capture and plan-specific CTA click tracking with data attributes.
src/components/Navigation.astro 5/5 Click tracking on nav CTA with location property.
package.json 5/5 Adds posthog-node dependency.
.gitignore 5/5 Adds .env to gitignore.
posthog-setup-report.md 4/5 Comprehensive setup report with event table and next steps.

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors; Astro is:inline scripts and define:vars are correctly used
Preserves existing env vars & configs Yes Existing code and configs preserved; only PostHog additions made
No syntax or type errors Yes All TypeScript and Astro syntax is valid
Correct imports/exports Yes posthog-node imported correctly server-side; client uses HTML snippet
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None No pre-existing issues observed

Issues

  • No .env.example for environment variables: PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST are added to .env (gitignored) but no .env.example or similar documentation is committed. Collaborators won't know which variables are required. Add a .env.example with placeholder values. [MEDIUM]

Other completed criteria

  • Build configuration is valid — posthog-node added correctly to package.json dependencies
  • .env correctly added to .gitignore
  • All imports resolve to correct packages

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-node v5.38.0 in package.json; client-side uses HTML snippet (no posthog-js package needed)
PostHog client initialized Yes Client: HTML snippet in posthog.astro with is:inline and define:vars for env injection, rendered in Layout <head>. Server: singleton pattern in posthog-server.ts
capture() Yes 10 meaningful events across 5 files covering CTAs, pricing, and contact form flows
identify() No Uses raw email as distinct_id on both client (posthog.identify(data.email, ...)) and server (distinctId: data.email), causing fragmented user profiles
Error tracking Yes captureException(error) called on client-side network errors in contact form
Reverse proxy No No reverse proxy configured; client snippet sends directly to PostHog host

Issues

  • Email used as distinct_id fragments user data: In contact.astro, window.posthog?.identify(data.email, ...) uses the email as the distinct ID. In api/contact.ts, posthog.identify({ distinctId: data.email }) and posthog.capture({ distinctId: data.email, event: 'contact_form_received' }) also use email. The server already receives X-PostHog-Distinct-Id from the client but ignores it for identify and successful form capture. This creates separate person profiles for the anonymous browser session and the email-based server events. The server should use distinctId from the header and call identify to link that ID to the email. The client should not use email as the first argument to identify. [CRITICAL]
  • No reverse proxy: Events from the browser go directly to the PostHog host, making them susceptible to ad blockers. Configure a reverse proxy (e.g., Astro middleware, Vercel rewrites, or PostHog's managed proxy). [MEDIUM]
  • Older snippet version: The snippet uses s.api_host+"/static/array.js" instead of the current s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js". This means assets load from the API host rather than the optimized assets domain. [LOW]

Other completed criteria

  • API key loaded from environment variable (PUBLIC_POSTHOG_PROJECT_TOKEN) via import.meta.env
  • API host configured from environment variable (PUBLIC_POSTHOG_HOST) via import.meta.env
  • PostHog component correctly uses is:inline directive per Astro framework rules
  • PostHog component imported in Layout and wraps all pages
  • Server-side client includes proper shutdown helper
  • defaults: '2026-01-30' set in client init

PostHog insights and events ⚠️

Filename PostHog events Description
src/pages/index.astro free_trial_clicked, contact_sales_clicked Hero section CTA click tracking with location: 'hero' property
src/components/Navigation.astro get_started_clicked Nav CTA click tracking with location: 'navigation' property
src/pages/pricing.astro pricing_page_viewed, pricing_plan_clicked Page view on load and plan-specific CTA clicks with plan property (starter/pro/enterprise)
src/pages/contact.astro contact_form_submitted, contact_form_error, captureException Form success/error tracking with interest and company properties; exception capture on network errors
src/pages/api/contact.ts contact_form_received, contact_form_validation_failed, contact_form_server_error Server-side form processing events with validation reason and error details

Issues

  • Server-side capture uses email as distinctId: The contact_form_received event uses data.email as distinctId instead of the client's distinct ID passed via X-PostHog-Distinct-Id header. This breaks the ability to build a proper funnel from client-side to server-side events since they'll be attributed to different persons. [CRITICAL]

Other completed criteria

  • Events represent real user actions (CTA clicks, form submissions, page views)
  • Events enable product insights — can build conversion funnel: pricing_page_viewed → pricing_plan_clicked → contact_form_submitted → contact_form_received
  • Events include relevant contextual properties (plan, location, interest, has_company, reason)
  • No PII in event properties — email/name only used in identify() person properties
  • Event names are descriptive and follow consistent snake_case convention

Reviewed by wizard workbench PR evaluator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants