Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 25, 2025

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 clicked
    • UPSELL_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

    • Both events include the upsellId in the payload for tracking specific upsells
  • Added comprehensive test coverage for the new telemetry functionality

Testing

  • All existing tests pass ✅
  • Added new tests to verify telemetry events are properly tracked
  • Tested both dismissal and click scenarios
  • Tested the combined scenario when dismissOnClick is true

Implementation Notes

  • Telemetry is captured before state changes to ensure events are sent even if component unmounts
  • Click tracking only fires when an onClick handler is provided (to avoid unnecessary events)
  • Follows existing telemetry patterns used throughout the codebase
  • No sensitive data is exposed in telemetry payloads

Related

Requested via Slack to improve analytics and understand user engagement with upsell messages.


Important

Adds telemetry tracking for DismissibleUpsell interactions, including new events and comprehensive tests.

  • Behavior:
    • Adds telemetry tracking to DismissibleUpsell for UPSELL_DISMISSED and UPSELL_CLICKED events in DismissibleUpsell.tsx.
    • Events include upsellId in payload.
    • Click tracking only occurs if onClick handler is provided.
    • Telemetry is captured before state changes to ensure event logging.
  • Testing:
    • Adds tests in DismissibleUpsell.spec.tsx to verify telemetry events for dismiss and click actions.
    • Tests cover scenarios with dismissOnClick true and false, and component unmounting.
  • Enums:
    • Adds UPSELL_DISMISSED and UPSELL_CLICKED to TelemetryEventName in telemetry.ts.

This description was created by Ellipsis for 0e88233. You can customize this summary. It will automatically update as commits are pushed.

- 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
Copy link
Contributor Author

@roomote roomote bot left a 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
Copy link
Contributor Author

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.

Suggested change
// 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 () => {
Copy link
Contributor Author

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, {
Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Member

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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brunobergher
Copy link
Collaborator

@roomote-agent implement the PR feedback.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 25, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Sep 25, 2025

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
@roomote
Copy link
Contributor Author

roomote bot commented Sep 25, 2025

Summary of updates implementing feedback:

Validation:

  • UI tests pass locally (webview-ui: 89/89).
  • Backend tests pass locally (src: 3839 passed, 48 skipped).
  • CI checks are green across analyze, compile, unit tests (ubuntu and windows), and integration-test.

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.

@daniel-lxs daniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Sep 25, 2025
@brunobergher brunobergher marked this pull request as ready for review September 25, 2025 15:39
@daniel-lxs daniel-lxs moved this from PR [Draft / In Progress] to PR [Needs Prelim Review] in Roo Code Roadmap Sep 25, 2025
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 25, 2025
@dosubot dosubot bot added Enhancement New feature or request lgtm This PR has been approved by a maintainer labels Sep 25, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Sep 25, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 25, 2025
@mrubens mrubens merged commit d959e88 into main Sep 25, 2025
26 of 28 checks passed
@mrubens mrubens deleted the feat/add-telemetry-dismissible-upsell branch September 25, 2025 17:29
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Sep 25, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 25, 2025
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Sep 25, 2025