[CI] (1776c51) astro/astro-hybrid-marketing#2712
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog into an Astro hybrid marketing site using the HTML snippet approach for client-side tracking and
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | No syntax or type errors; all files are valid Astro/TS |
| Preserves existing env vars & configs | Yes | Existing config untouched; removed PII from console.log (improvement) |
| No syntax or type errors | Yes | All changed files have valid syntax |
| Correct imports/exports | Yes | posthog-node import and Astro component imports are correct |
| Minimal, focused changes | Yes | All changes serve PostHog integration |
| Pre-existing issues | None | Base app is clean |
Issues
- No
.env.examplecommitted: Environment variablesPUBLIC_POSTHOG_PROJECT_TOKENandPUBLIC_POSTHOG_HOSTare used but not documented in a committed example file. Collaborators won't know which vars to set. [MEDIUM]
Other completed criteria
- Build configuration valid —
package.jsondependencies parse correctly - Existing app code and configs preserved
- Changes are minimal and focused on PostHog integration
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js and posthog-node in package.json; client uses HTML snippet (loads from CDN) |
| PostHog client initialized | Yes | Client: snippet in posthog.astro with is:inline + define:vars; Server: singleton in posthog-server.ts |
| capture() | Yes | 10 distinct events across client and server covering CTAs, form submissions, validation failures, and server errors |
| identify() | No | Client-side uses raw email as distinct_id; server-side correctly uses header-provided distinct ID |
| Error tracking | Yes | captureException() on both client (contact form catch) and server (API error handler) |
| Reverse proxy | No | Not configured; client-side events go directly to us.i.posthog.com |
Issues
posthog.shutdown()destroys server singleton:getPostHogServer()caches the client in a module-level variable, butshutdown()is called on every request (lines 98, 124 ofcontact.ts). After the first request completes, the cached reference points to a terminated client. All subsequent requests silently drop events. Fix: useawait posthog.flush()instead ofshutdown(), or setposthogClient = nullafter shutdown so the next call recreates the client. [CRITICAL]- Email as
distinct_idin client-side identify:window.posthog?.identify(email, { email, name, ... })incontact.astrouses the user's email address as their distinct ID. This causes fragmented person profiles when the same user submits from multiple devices. The correct pattern isposthog.identify(someStableUserId, { email })or to useposthog.setPersonProperties({ email })without changing the distinct ID. [CRITICAL] - No reverse proxy: Marketing sites are especially susceptible to ad blockers. Without a reverse proxy, conversion tracking events (the core value of this integration) may be silently blocked. [MEDIUM]
- Older snippet version: The snippet loads the SDK from
api_host + '/static/array.js'instead of the newer pattern usingapi_host.replace(".i.posthog.com", "-assets.i.posthog.com") + "/static/array.js"which routes through the assets CDN. [LOW] enableExceptionAutocapturenot a valid posthog-node option: This config key inposthog-server.tsis aposthog-jsbrowser option, not aposthog-nodeoption. It will be silently ignored. [LOW]
Other completed criteria
- API key loaded from environment variable (
PUBLIC_POSTHOG_PROJECT_TOKEN) - Host correctly configured (
PUBLIC_POSTHOG_HOST→https://us.i.posthog.com) - Uses correct Astro
PUBLIC_prefix for client-side env vars is:inlinedirective used correctly on all PostHog script tags- PostHog component created in
src/components/and imported in Layout (matches Astro docs pattern) - Server-side distinct ID correctly extracted from
X-POSTHOG-DISTINCT-IDheader - Session ID forwarded via
X-POSTHOG-SESSION-IDheader for cross-client/server linkage
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
src/pages/index.astro |
cta_clicked |
Tracks hero CTA clicks with label, location, and destination properties |
src/pages/pricing.astro |
pricing_cta_clicked, contact_sales_clicked |
Tracks pricing plan CTA interactions with plan name and CTA type |
src/pages/contact.astro |
contact_form_submitted, contact_form_submission_failed |
Client-side form success/failure with interest and submission context |
src/pages/api/contact.ts |
contact_form_received, contact_form_validation_failed, contact_form_server_error, captureException |
Server-side form processing events covering success, validation errors, and unexpected errors |
src/components/Navigation.astro |
navigation_cta_clicked |
Tracks "Get Started" navigation CTA with location and path |
src/components/Footer.astro |
footer_link_clicked |
Tracks footer link clicks with link text, destination, and current path |
Issues
No event quality issues.
Other completed criteria
- Events represent real user actions in a marketing funnel (CTA clicks → form submission → server receipt)
- Events enable product insights — can build CTA conversion funnels, form completion rates, and failure analysis
- All events include enriched contextual properties (plan, location, interest, path)
- No PII in capture event properties — email/name only set via
identify()person properties - Event names are descriptive, consistent snake_case, and clearly describe the action
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:
1776c51App:
astro/astro-hybrid-marketingApp directory:
apps/astro/astro-hybrid-marketingWorkbench branch:
wizard-ci-1776c51-astro-astro-hybrid-marketingWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-07-10T23:20:32.338Z
Duration: 508.4s
YARA Scanner