Skip to content

[CI] (c826a31) astro/astro-hybrid-marketing - #2392

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: c826a31
App: astro/astro-hybrid-marketing
App directory: apps/astro/astro-hybrid-marketing
Workbench branch: wizard-ci-c826a31-astro-astro-hybrid-marketing
Wizard branch: posthog-code/pi-telemetry-parity
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-03T15:10:25.782Z
Duration: 320.9s

YARA Scanner

✓ 41 tool calls scanned, 0 violations detected

No violations: ✓ 41 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into an Astro hybrid marketing site (NeuralFlow AI) by adding a client-side JavaScript snippet via a posthog.astro component loaded in the shared layout, a server-side posthog-node singleton for API routes, and event captures for CTA clicks, pricing plan selections, and contact form submissions on both client and server.

Files changed Lines added Lines removed
10 +156 -6

Confidence score: 4/5 👍

  • Email used as distinct_id: Both client-side identify(email, ...) and server-side posthog.identify({ distinctId: data.email }) use the user's raw email as the distinct ID. This is a known anti-pattern — if the user changes their email, their history fragments into two separate people. Use a stable internal user ID instead. [CRITICAL]
  • No reverse proxy configured: The client-side snippet loads posthog-js directly from PostHog's servers, making it susceptible to ad blockers. No reverse proxy or managed proxy is set up. [MEDIUM]
  • No .env.example: The new environment variables PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST are not documented in any .env.example file. The setup report itself flags this as a TODO. [MEDIUM]
  • Outdated snippet: The client-side snippet uses the older format that loads from api_host + "/static/array.js" instead of the recommended asset host pattern (api_host.replace(".i.posthog.com", "-assets.i.posthog.com") + "/static/array.js"). [LOW]

File changes

Filename Score Description
src/components/posthog.astro 3/5 New PostHog client snippet component with is:inline and define:vars for env vars; uses older snippet format
src/layouts/Layout.astro 5/5 Imports and renders PostHog component in <head>
src/lib/posthog-server.ts 4/5 Server-side PostHog singleton with shutdown support; uses PUBLIC_ prefixed env vars
src/pages/api/contact.ts 2/5 Server-side capture and identify using raw email as distinct_id; inconsistent distinctId logic
src/pages/contact.astro 3/5 Client-side capture, identify (email as distinct_id), error tracking via captureException
src/pages/index.astro 5/5 Clean event captures for hero CTA buttons with location property
src/pages/pricing.astro 5/5 Clean event captures for pricing plan CTAs with plan property via data attributes
package.json 5/5 Added posthog-node dependency
.gitignore 5/5 Added .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 or type errors; dependencies are valid
Preserves existing env vars & configs Yes Existing code and configs are preserved; only additive changes
No syntax or type errors Yes All TypeScript and Astro syntax is valid
Correct imports/exports Yes posthog-node imported correctly on server; component imports valid
Minimal, focused changes Yes All changes are PostHog-related
Pre-existing issues None

Issues

  • No .env.example file: New environment variables PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST are not documented anywhere. Collaborators won't know what to set. Create a .env.example with placeholder values. [MEDIUM]

Other completed criteria

  • All changes are relevant to PostHog integration
  • Correct files modified for Astro framework (component, layout, pages)
  • No unnecessary modifications or unrelated refactors
  • Code follows existing codebase patterns (inline scripts, Astro component structure)
  • Build configuration valid — posthog-node added correctly to dependencies

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-node ^5.39.4 in package.json; client-side via HTML snippet
PostHog client initialized Yes Client: snippet in posthog.astro with is:inline and define:vars; Server: singleton in posthog-server.ts
capture() Yes 6 distinct events captured across client and server
identify() No Uses raw email as distinct_id — causes fragmented data if email changes
Error tracking Yes posthog.captureException(error) in contact form catch block
Reverse proxy No No reverse proxy configured; client snippet loads directly from PostHog

Issues

  • Email as distinct_id: In contact.astro, posthog.identify(email, ...) and in api/contact.ts, posthog.identify({ distinctId: data.email }) both use the user's email as the distinct ID. This is a known anti-pattern that causes fragmented user profiles if emails change. Use a stable internal user ID and pass email only as a person property. [CRITICAL]
  • Inconsistent server-side distinctId: In api/contact.ts, the failure events use distinctId: distinctId || 'anonymous' (which reads from a header or falls back to email), but the success event hardcodes distinctId: data.email, ignoring the header entirely. [MEDIUM]
  • No reverse proxy: Client-side PostHog snippet loads directly from us.i.posthog.com, making analytics susceptible to ad blockers. Configure a managed reverse proxy or framework-level proxy. [MEDIUM]
  • Outdated snippet format: The snippet uses s.api_host+"/static/array.js" instead of the recommended s.api_host.replace(".i.posthog.com", "-assets.i.posthog.com") + "/static/array.js" asset host pattern. [LOW]

Other completed criteria

  • API key loaded from environment variable (PUBLIC_POSTHOG_PROJECT_TOKEN)
  • API host correctly configured with env var and fallback to https://us.i.posthog.com
  • is:inline directive correctly used on script tags per Astro framework rules
  • PUBLIC_ prefix correctly used for client-side env vars in Astro
  • PostHog component created in src/components/ and imported in Layout
  • Server-side singleton pattern with proper shutdown support

PostHog insights and events ⚠️

Filename PostHog events Description
src/pages/index.astro free_trial_clicked, contact_sales_clicked Captures hero CTA button clicks with location property
src/pages/pricing.astro pricing_plan_cta_clicked Captures pricing plan CTA clicks with plan property (starter/pro/enterprise)
src/pages/contact.astro contact_form_submitted, captureException Client-side form submission capture and error tracking
src/pages/api/contact.ts contact_form_received, contact_form_failed Server-side form validation tracking with reason and interest properties

Issues

  • No PII concerns in capture properties: Event properties are clean (no emails/names in capture calls), but the identify() using email as distinct_id is still problematic as noted above. [CRITICAL — covered in PostHog implementation]

Other completed criteria

  • Events represent real user actions (CTA clicks, form submissions, validation failures)
  • Events enable product insights — can build lead generation funnel (page view → CTA click → form submit → form received)
  • Events include relevant contextual properties (plan type, location, interest, failure reason)
  • No PII in event properties — email/name only in identify person properties
  • Event names are descriptive and use 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