Skip to content

feat(website): track email signups in PostHog#1702

Draft
anthonyiscoding wants to merge 4 commits into
mainfrom
add/posthog-events
Draft

feat(website): track email signups in PostHog#1702
anthonyiscoding wants to merge 4 commits into
mainfrom
add/posthog-events

Conversation

@anthonyiscoding

@anthonyiscoding anthonyiscoding commented May 27, 2026

Copy link
Copy Markdown
Contributor

What

Records a website_email_submit event in PostHog when a visitor successfully submits the email signup form (hero or footer), mirroring the existing Common Room notification.

  • Fires from inside submitToMailmodo, gated on Mailmodo success (2xx/409) — in lockstep with the Common Room signals.form call.
  • Identifies the PostHog person by email (the same key Common Room de-anonymizes on), which creates the person profile under person_profiles: 'identified_only'.
  • Attaches the Common Room visitor id (signals-sdk-user-id cookie) as both an event property and a person property when present, so the two systems can be joined per visitor. Read once at submit time; if the cookie isn't set yet we just record without it.
  • Captures form_location (hero / footer).

No new event volume on anonymous traffic — only submitters become identified.

Files

  • website/posthog-consent.jswindow.iiiNotifyPostHogEmailSubmit(email, formLocation) helper.
  • website/index.html — wires the helper into the hero/footer submit flow.

Notes

  • Because tracking is gated on Mailmodo success, submissions Mailmodo rejects won't reach PostHog or Common Room — intended, but worth knowing analytics undercounts while Mailmodo rejections are unresolved.

🤖 Generated with Claude Code

@vercel

vercel Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
iii-website Ready Ready Preview, Comment May 27, 2026 9:32pm

Request Review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 489d4da7-721f-490d-978c-a071d1f5b1a8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add/posthog-events

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@anthonyiscoding anthonyiscoding changed the base branch from add/real-system-tutorial to main May 27, 2026 21:30
anthonyiscoding and others added 4 commits May 27, 2026 16:31
Capture a website_email_submit event in PostHog when a user successfully
submits the email signup form, mirroring the Common Room notify timing but
without the email address — only that a submission happened. Attach the
Common Room visitor id (signals-sdk-user-id cookie) as both an event and
person property so the two systems can be joined per visitor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Under person_profiles: 'identified_only' a bare $set on an anonymous
visitor is dropped, so attach the Common Room visitor id via
posthog.identify() instead — this creates the person profile and keys it
to Common Room. Still capture website_email_submit so the conversion is
recorded even without a Common Room id. No email is sent to PostHog.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ookie

Record the email in PostHog and identify the person by it (the key Common
Room also de-anonymizes on), attaching the Common Room visitor id when
present so the two systems join per visitor. Common Room writes its
signals-sdk-user-id cookie asynchronously, so if it's absent at submit time
wait 2s and retry once before recording without it. The submission is
always recorded either way, with or without the Common Room id.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Read the signals-sdk-user-id cookie once at submit time and fire
identify + capture immediately, instead of waiting 2s and retrying when
the cookie is absent. If Common Room hasn't written the cookie yet we
simply record without common_room_user_id.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant