-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Use stable PostHog identity for newsletter signups #6588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,9 @@ | |||||||||||||||
|
|
||||||||||||||||
| import httpx | ||||||||||||||||
| from email_validator import EmailNotValidError, ValidatedEmail, validate_email | ||||||||||||||||
| from reflex_components_internal.blocks.telemetry import ( | ||||||||||||||||
| track_newsletter_posthog_subscription, | ||||||||||||||||
| ) | ||||||||||||||||
|
|
||||||||||||||||
| import reflex as rx | ||||||||||||||||
| from reflex_site_shared.constants import ( | ||||||||||||||||
|
|
@@ -102,6 +105,7 @@ async def signup( | |||||||||||||||
| }, | ||||||||||||||||
| ) | ||||||||||||||||
| return | ||||||||||||||||
| yield track_newsletter_posthog_subscription(email) | ||||||||||||||||
| yield IndexState.send_contact_to_webhook(email) | ||||||||||||||||
| yield IndexState.add_contact_to_loops(email) | ||||||||||||||||
|
Comment on lines
+108
to
110
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
| async with self: | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
canonicalDistinctIdis truthy,posthog.identify(canonicalDistinctId, personProps)is called and thenposthog.capture(event_name, {..., $set: personProps})is called immediately after with the samepersonPropsin$set. PostHog merges both writes, so this is harmless in practice, but the$setpayload on the capture event is redundant whenidentifyalready carries the same data. Removing the$setattachment whencanonicalDistinctIdis present would eliminate the duplicate write, though this is a minor analytics hygiene concern.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!