-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: Add telemetry tracking to DismissibleUpsell component #8309
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
Conversation
- Added UPSELL_DISMISSED and UPSELL_CLICKED events to TelemetryEventName enum - Updated DismissibleUpsell component to track clicks and dismissals with telemetry - Added telemetry tests to DismissibleUpsell test suite - Events include upsellId in the payload for tracking specific upsells
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.
Self-review: the robot audited itself and filed three politely pedantic remarks.
| }, [upsellId]) | ||
|
|
||
| const handleDismiss = async () => { | ||
| // Track telemetry for dismissal |
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.
P2: handleDismiss is marked async but doesn’t await anything. Making it synchronous avoids misleading consumers and minor overhead.
| // Track telemetry for dismissal | |
| const handleDismiss = () => { |
| }) | ||
|
|
||
| it("dismisses when clicked if dismissOnClick is true", async () => { | ||
| it("dismisses when clicked if dismissOnClick is true and tracks both telemetry events", async () => { |
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.
P3: Add a test for the scenario where dismissOnClick is true and no onClick is provided. Expect only UPSELL_DISMISSED to be captured (and not UPSELL_CLICKED) to lock in the intended behavior.
| onClick={() => { | ||
| // Track telemetry for click | ||
| if (onClick) { | ||
| telemetryClient.capture(TelemetryEventName.UPSELL_CLICKED, { |
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.
P3: Intentional behavior: UPSELL_CLICKED is emitted only when onClick exists. If analytics should also capture container-dismiss without onClick (dismissOnClick=true), consider adding a separate event or documenting this decision.
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.
Good point, let's make sure to track these as dismissals.
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.
Not sure if Roomote implemented this change, it doesn't seem like it did
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.
This seems to be right, wdyt?
|
@roomote-agent implement the PR feedback. |
|
Acknowledged. I will: 1) make handleDismiss synchronous, 2) ensure that when dismissOnClick is true and no onClick is provided we only capture UPSELL_DISMISSED (not UPSELL_CLICKED), and 3) add a dedicated test for that scenario. I will push updates to feat/add-telemetry-dismissible-upsell shortly. |
test(webview): add scenario where dismissOnClick=true without onClick tracks only UPSELL_DISMISSED; update tests; all tests passing locally
|
Summary of updates implementing feedback:
Validation:
Result: telemetry behavior is now consistent with the decision to treat container-click dismissals (without onClick) strictly as dismiss events, while retaining click telemetry only when an onClick exists. |
Summary
This PR adds telemetry tracking to the DismissibleUpsell component to track user interactions with upsell messages.
Changes
Added two new telemetry events to TelemetryEventName enum:
UPSELL_DISMISSED- Triggered when the dismiss button is clickedUPSELL_CLICKED- Triggered when the upsell container is clicked (only if onClick handler is provided)Updated DismissibleUpsell component to track these events using the existing PostHog infrastructure
upsellIdin the payload for tracking specific upsellsAdded comprehensive test coverage for the new telemetry functionality
Testing
dismissOnClickis trueImplementation Notes
Related
Requested via Slack to improve analytics and understand user engagement with upsell messages.
Important
Adds telemetry tracking for
DismissibleUpsellinteractions, including new events and comprehensive tests.DismissibleUpsellforUPSELL_DISMISSEDandUPSELL_CLICKEDevents inDismissibleUpsell.tsx.upsellIdin payload.onClickhandler is provided.DismissibleUpsell.spec.tsxto verify telemetry events for dismiss and click actions.dismissOnClicktrue and false, and component unmounting.UPSELL_DISMISSEDandUPSELL_CLICKEDtoTelemetryEventNameintelemetry.ts.This description was created by
for 0e88233. You can customize this summary. It will automatically update as commits are pushed.