Skip to content

feat(analytics): track chat browser touchpoints#3269

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:feat/analytics-cef-click-events
Jun 3, 2026
Merged

feat(analytics): track chat browser touchpoints#3269
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:feat/analytics-cef-click-events

Conversation

@senamakel
Copy link
Copy Markdown
Member

@senamakel senamakel commented Jun 3, 2026

Summary

  • Adds a dedicated allowlisted tauri_browser_click OpenPanel event for the React-owned Tauri browser/right-sidebar chrome in chat.
  • Tracks account rail selections, add-account entry, disconnects, respond queue actions, and webview load retries with provider-level metadata only.
  • Adds stable data-analytics-id values to chat/account click targets so global ui_click captures meaningful control IDs.
  • Documents the practical boundary: React can capture the CEF host chrome, while in-page child-webview clicks require a separate CDP/browser instrumentation path.

Problem

  • The global UI interaction tracker could capture normal React DOM buttons, but the chat browser/right-sidebar surface had anonymous controls and no dedicated OpenPanel event for CEF-related touchpoints.
  • Native CEF child-webview page clicks are not visible to React DOM delegation, so the React-owned browser chrome needed explicit instrumentation at the component boundary.

Solution

  • Allowlist tauri_browser_click in app/src/services/analytics.ts.
  • Emit tauri_browser_click from account/sidebar and webview retry boundaries with surface, action, provider, and non-sensitive status metadata.
  • Add stable data-analytics-id attributes across the chat/account subtree: account modal, respond queue, webview host retry, approval/artifact/file controls, composer/header controls, reactions, and error actions.
  • Add focused analytics test coverage for the new OpenPanel event.

Submission Checklist

If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
  • Diff coverage ≥ 80% — changed lines (Vitest + cargo-llvm-cov merged via diff-cover) meet the gate enforced by .github/workflows/pr-ci.yml. Run pnpm test:coverage and pnpm test:rust locally; PRs below 80% on changed lines will not merge.
  • Coverage matrix updated — N/A: analytics instrumentation only; no feature row added/removed/renamed.
  • All affected feature IDs from the matrix are listed in the PR description under ## Related — N/A: no coverage-matrix feature ID applies.
  • No new external network dependencies introduced (mock backend used per Testing Strategy)
  • Manual smoke checklist updated if this touches release-cut surfaces (docs/RELEASE-MANUAL-SMOKE.md) — N/A: analytics instrumentation only; no release smoke procedure changed.
  • Linked issue closed via Closes #NNN in the ## Related section — N/A: no linked issue provided.

Impact

  • Desktop React/Tauri UI analytics only.
  • No new network dependency; events use the existing consent-gated analytics service and existing OpenPanel ingestion path.
  • Event metadata intentionally avoids account IDs, thread IDs, titles, filenames, message text, URLs, and child-webview page content.

Related

  • Closes: N/A
  • Follow-up PR(s)/TODOs: CEF child-webview in-page click analytics would require separate CDP/browser instrumentation if needed.

AI Authored PR Metadata (required for Codex/Linear PRs)

Keep this section for AI-authored PRs. For human-only PRs, mark each field N/A.

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: feat/analytics-cef-click-events
  • Commit SHA: 46dfbb7cc

Validation Run

  • pnpm --filter openhuman-app format:check
  • pnpm typecheck
  • Focused tests: pnpm debug unit src/services/__tests__/analytics.test.ts (32 passed); pnpm test:coverage (4,870 passed, 4 skipped)
  • Rust fmt/check (if changed): cargo fmt --manifest-path ../Cargo.toml --all --check ran via pre-push format:check; no Rust files changed.
  • Tauri fmt/check (if changed): cargo fmt --manifest-path app/src-tauri/Cargo.toml --all --check and cargo check --manifest-path app/src-tauri/Cargo.toml ran via pre-push; no Tauri files changed.

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: consent-gated OpenPanel receives explicit Tauri browser/sidebar click events and more stable generic UI click identifiers for chat/account controls.
  • User-visible effect: none.

Parity Contract

  • Legacy behavior preserved: existing global ui_click, ui_control_change, and ui_form_submit tracking behavior remains in place.
  • Guard/fallback/dispatch parity checks: new events are allowlisted and use existing trackEvent consent and ingestion path.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): N/A
  • Canonical PR: N/A
  • Resolution (closed/superseded/updated): N/A

@senamakel senamakel requested a review from a team June 3, 2026 03:55
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Warning

Review limit reached

@senamakel, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 43 minutes and 32 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c95eb3b4-7f55-40a3-86e5-893b34272083

📥 Commits

Reviewing files that changed from the base of the PR and between 468ca7b and 46dfbb7.

📒 Files selected for processing (16)
  • app/src/components/accounts/AddAccountModal.tsx
  • app/src/components/accounts/RespondQueuePanel.tsx
  • app/src/components/accounts/WebviewHost.tsx
  • app/src/components/chat/ApprovalRequestCard.tsx
  • app/src/components/chat/ArtifactCard.tsx
  • app/src/components/chat/AttachmentPreview.tsx
  • app/src/components/chat/ChatComposer.tsx
  • app/src/components/chat/ChatFilesChip.tsx
  • app/src/components/chat/ChatFilesPanel.tsx
  • app/src/components/chat/ModelQualityPill.tsx
  • app/src/components/chat/TokenUsagePill.tsx
  • app/src/components/chat/UnsubscribeApprovalCard.tsx
  • app/src/pages/Accounts.tsx
  • app/src/pages/Conversations.tsx
  • app/src/services/__tests__/analytics.test.ts
  • app/src/services/analytics.ts

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

@senamakel senamakel merged commit b04b4c8 into tinyhumansai:main Jun 3, 2026
19 of 22 checks passed
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