Skip to content

[WEB-4405] chore: profile settings events#7313

Merged
sriramveeraghanta merged 48 commits intopreviewfrom
chore-profile-settings-events
Jul 10, 2025
Merged

[WEB-4405] chore: profile settings events#7313
sriramveeraghanta merged 48 commits intopreviewfrom
chore-profile-settings-events

Conversation

@gakshita
Copy link
Collaborator

@gakshita gakshita commented Jul 2, 2025

Description

Implemented posthog events for profile settings

Summary by CodeRabbit

  • New Features

    • Added event tracking for actions and updates in profile settings, including account deactivation, profile updates, preferences (language, timezone, start of week, theme), notification settings, and API token management.
    • Introduced tracking identifiers to UI elements for improved interaction monitoring.
  • Bug Fixes

    • None.
  • Style

    • None.
  • Documentation

    • None.
  • Chores

    • None.

Prateek Shourya and others added 30 commits June 30, 2025 17:19
* chore: update event tracker helper types

* refactor: cycle events

* refactor: cycle events

* refactor: cycle event tracker

* chore: update tracker elements

* chore: check for closest element with data-ph-element attribute

---------

Co-authored-by: Prateek Shourya <prateekshourya@Prateeks-MacBook-Pro.local>
* chore: update event tracker helper types

* refactor: cycle events

* refactor: cycle events

* refactor: cycle event tracker

* refactor: module tracker event and element

* chore: update tracker element

* chore: revert unnecessary changes

---------

Co-authored-by: Prateek Shourya <prateekshourya@Prateeks-MacBook-Pro.local>
refactor: global views, product tour, notifications, onboarding, users and sidebar related events
* chore: member-tracker-events

* fix: constants
* chore: state events

* fix: refactor
* chore: project-events

* fix: refactor
@CLAassistant
Copy link

CLAassistant commented Jul 2, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
5 out of 6 committers have signed the CLA.

✅ prateekshourya29
✅ gakshita
✅ Palanikannan1437
✅ sriramveeraghanta
✅ vamsikrishnamathala
❌ Prateek Shourya


Prateek Shourya seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 2, 2025

Warning

Rate limit exceeded

@gakshita has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 38 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between e72becd and 444c5d6.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • web/core/components/core/theme/custom-theme-selector.tsx (2 hunks)
  • web/core/components/profile/form.tsx (5 hunks)

Walkthrough

This update introduces comprehensive event tracking for profile settings actions and UI elements. It adds new tracking constants and integrates event capture calls across various profile-related components, including account deactivation, API token management, theme selection, notification preferences, language/timezone, and start-of-week settings. No existing logic is altered.

Changes

File(s) Change Summary
packages/constants/src/event-tracker/core.ts Added exported constants for profile settings tracker events and elements.
web/app/(all)/[workspaceSlug]/(settings)/settings/account/api-tokens/page.tsx Added event tracking calls to all "Create API Token" button click handlers.
web/core/components/account/deactivate-account-modal.tsx Added event capture for success and error outcomes in the account deactivation flow.
web/core/components/api-token/delete-token-modal.tsx Added event tracking for API token deletion success and error cases.
web/core/components/api-token/modal/create-token-modal.tsx Added event tracking for success and error during API token creation.
web/core/components/api-token/token-list-item.tsx Added data attribute for tracking to the delete button in API token list items.
web/core/components/core/theme/custom-theme-selector.tsx Added event tracking to theme update handler.
web/core/components/profile/form.tsx Instrumented profile update with event tracking and added tracking data attributes to key buttons.
web/core/components/profile/notification/email-notification-form.tsx Added event tracking for notification settings updates and toggle interactions.
web/core/components/profile/preferences/language-timezone.tsx Added event tracking for language and timezone updates, on both success and failure.
web/core/components/profile/start-of-week-preference.tsx Added event tracking for start-of-week preference updates, on both success and failure.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI_Component
    participant EventTracker

    User->>UI_Component: Interacts (e.g., click, submit, toggle)
    UI_Component->>EventTracker: captureClick/captureSuccess/captureError (with event & element)
    EventTracker-->>UI_Component: Logs event
    UI_Component-->>User: Updates UI (if applicable)
Loading

Possibly related PRs

  • makeplane/plane#7289: Refactors event tracker constants, directly related to the addition of new profile settings tracker constants in this PR.
  • makeplane/plane#7033: Implements the start-of-week preference feature, which is now instrumented with tracking in this PR.

Suggested labels

ready_to_merge

Suggested reviewers

  • prateekshourya29

Poem

In the meadow of code, a rabbit hops quick,
Tracking each click, every toggle and pick.
With constants and calls, the events now appear,
From tokens to themes, all actions are clear.
A hop and a skip, with carrots in sight,
This tracking update makes metrics just right!
🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented Jul 2, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (1)
web/core/components/api-token/delete-token-modal.tsx (1)

62-78: Fix duplicate catch blocks in promise chain.

The promise chain has two separate .catch() blocks, which means the second catch block (lines 69-77) for event tracking will never execute because the first catch block (lines 62-68) already handles the error.

Combine both error handling and event tracking in a single catch block:

      .catch((err) => {
+        captureError({
+          eventName: PROFILE_SETTINGS_TRACKER_EVENTS.pat_deleted,
+          payload: {
+            token: tokenId,
+          },
+          error: err as Error,
+        });
        setToast({
          type: TOAST_TYPE.ERROR,
          title: t("workspace_settings.settings.api_tokens.delete.error.title"),
          message: err?.message ?? t("workspace_settings.settings.api_tokens.delete.error.message"),
-        })
-      )
-      .catch((err) => {
-        captureError({
-          eventName: PROFILE_SETTINGS_TRACKER_EVENTS.pat_deleted,
-          payload: {
-            token: tokenId,
-          },
-          error: err as Error,
-        });
-      })
+        });
+      })
🧹 Nitpick comments (1)
web/core/components/profile/notification/email-notification-form.tsx (1)

131-140: Consider adding consistent tracking to the issue_completed toggle.

The issue_completed toggle doesn't include captureClick tracking like the other toggles (property_change, state_change, comment, mention). This inconsistency might affect analytics completeness.

If this omission is intentional, consider adding a comment explaining why. Otherwise, add tracking for consistency:

                <ToggleSwitch
                  value={value}
                  onChange={(newValue) => {
                    onChange(newValue);
+                   captureClick({
+                     elementName: PROFILE_SETTINGS_TRACKER_ELEMENTS.ISSUE_COMPLETED_TOGGLE,
+                   });
                    handleSettingChange("issue_completed", newValue);
                  }}
                  size="sm"
                />

Note: This assumes the constant ISSUE_COMPLETED_TOGGLE exists in PROFILE_SETTINGS_TRACKER_ELEMENTS.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5874636 and e72becd.

📒 Files selected for processing (11)
  • packages/constants/src/event-tracker/core.ts (1 hunks)
  • web/app/(all)/[workspaceSlug]/(settings)/settings/account/api-tokens/page.tsx (5 hunks)
  • web/core/components/account/deactivate-account-modal.tsx (3 hunks)
  • web/core/components/api-token/delete-token-modal.tsx (3 hunks)
  • web/core/components/api-token/modal/create-token-modal.tsx (4 hunks)
  • web/core/components/api-token/token-list-item.tsx (3 hunks)
  • web/core/components/core/theme/custom-theme-selector.tsx (2 hunks)
  • web/core/components/profile/form.tsx (5 hunks)
  • web/core/components/profile/notification/email-notification-form.tsx (6 hunks)
  • web/core/components/profile/preferences/language-timezone.tsx (3 hunks)
  • web/core/components/profile/start-of-week-preference.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
web/app/(all)/[workspaceSlug]/(settings)/settings/account/api-tokens/page.tsx (2)
Learnt from: vamsikrishnamathala
PR: makeplane/plane#7061
File: web/core/components/workspace-notifications/root.tsx:18-18
Timestamp: 2025-05-14T13:16:23.323Z
Learning: In the Plane project codebase, the path alias `@/plane-web` resolves to the `ce` directory, making imports like `@/plane-web/hooks/use-notification-preview` correctly resolve to files in `web/ce/hooks/`.
Learnt from: janreges
PR: makeplane/plane#6743
File: packages/i18n/src/store/index.ts:160-161
Timestamp: 2025-03-11T19:42:41.769Z
Learning: In the Plane project, the file 'packages/i18n/src/store/index.ts' already includes support for Polish language translations with the case "pl".
web/core/components/profile/form.tsx (1)
Learnt from: vamsikrishnamathala
PR: makeplane/plane#7061
File: web/core/components/workspace-notifications/root.tsx:18-18
Timestamp: 2025-05-14T13:16:23.323Z
Learning: In the Plane project codebase, the path alias `@/plane-web` resolves to the `ce` directory, making imports like `@/plane-web/hooks/use-notification-preview` correctly resolve to files in `web/ce/hooks/`.
web/core/components/profile/preferences/language-timezone.tsx (1)
Learnt from: janreges
PR: makeplane/plane#6743
File: packages/i18n/src/store/index.ts:160-161
Timestamp: 2025-03-11T19:42:41.769Z
Learning: In the Plane project, the file 'packages/i18n/src/store/index.ts' already includes support for Polish language translations with the case "pl".
🧬 Code Graph Analysis (6)
web/app/(all)/[workspaceSlug]/(settings)/settings/account/api-tokens/page.tsx (2)
web/helpers/event-tracker.helper.ts (1)
  • captureClick (52-54)
packages/constants/src/event-tracker/core.ts (1)
  • PROFILE_SETTINGS_TRACKER_ELEMENTS (287-305)
web/core/components/api-token/token-list-item.tsx (1)
packages/constants/src/event-tracker/core.ts (1)
  • PROFILE_SETTINGS_TRACKER_ELEMENTS (287-305)
web/core/components/core/theme/custom-theme-selector.tsx (2)
web/helpers/event-tracker.helper.ts (1)
  • captureElementAndEvent (139-146)
packages/constants/src/event-tracker/core.ts (2)
  • PROFILE_SETTINGS_TRACKER_ELEMENTS (287-305)
  • PROFILE_SETTINGS_TRACKER_EVENTS (272-286)
web/core/components/profile/form.tsx (2)
web/helpers/event-tracker.helper.ts (1)
  • captureSuccess (112-114)
packages/constants/src/event-tracker/core.ts (2)
  • PROFILE_SETTINGS_TRACKER_EVENTS (272-286)
  • PROFILE_SETTINGS_TRACKER_ELEMENTS (287-305)
web/core/components/profile/start-of-week-preference.tsx (3)
web/helpers/event-tracker.helper.ts (1)
  • captureElementAndEvent (139-146)
packages/constants/src/event-tracker/core.ts (2)
  • PROFILE_SETTINGS_TRACKER_ELEMENTS (287-305)
  • PROFILE_SETTINGS_TRACKER_EVENTS (272-286)
packages/ui/src/toast/index.tsx (1)
  • setToast (63-190)
web/core/components/profile/preferences/language-timezone.tsx (3)
web/helpers/event-tracker.helper.ts (1)
  • captureElementAndEvent (139-146)
packages/constants/src/event-tracker/core.ts (2)
  • PROFILE_SETTINGS_TRACKER_ELEMENTS (287-305)
  • PROFILE_SETTINGS_TRACKER_EVENTS (272-286)
packages/ui/src/toast/index.tsx (1)
  • setToast (63-190)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (15)
packages/constants/src/event-tracker/core.ts (1)

272-305: LGTM! Well-structured tracking constants.

The new profile settings tracking constants are well-organized, follow established naming conventions, and provide comprehensive coverage for profile settings interactions. The categorization by functionality (Account, Preferences, Notifications, PAT) makes them easy to understand and maintain.

web/core/components/api-token/token-list-item.tsx (2)

5-5: Import addition looks good.

The import of PROFILE_SETTINGS_TRACKER_ELEMENTS is correctly added for the tracking attribute.


35-35: Element tracking attribute properly implemented.

The data-ph-element attribute is correctly added to the delete button using the appropriate constant, enabling proper tracking of user interactions with the delete functionality.

web/app/(all)/[workspaceSlug]/(settings)/settings/account/api-tokens/page.tsx (2)

7-7: Tracking imports properly added.

The imports for tracking constants and helper function are correctly added.

Also applies to: 18-18


58-63: Click tracking consistently implemented.

The captureClick calls are properly implemented across all buttons that open the create token modal. Good differentiation between header and empty state buttons using different element identifiers, which will provide valuable analytics insights.

Also applies to: 79-84, 96-101

web/core/components/core/theme/custom-theme-selector.tsx (1)

7-7: Tracking imports correctly added.

The imports for tracking constants and helper function are properly added.

Also applies to: 13-13

web/core/components/api-token/modal/create-token-modal.tsx (2)

6-6: Tracking imports properly added.

The imports for tracking constants and helper functions are correctly added.

Also applies to: 16-16


71-87: Event tracking correctly implemented for async operation.

The tracking calls are properly placed within the promise success and error handlers, ensuring accurate capture of the actual operation outcomes. Good use of payload data (token ID) for success cases, which will be valuable for analytics.

web/core/components/account/deactivate-account-modal.tsx (1)

6-6: Event tracking implementation looks good!

The tracking calls are properly placed within the success and error handlers, and the import statements are correctly added.

Also applies to: 11-11, 40-42, 53-55

web/core/components/profile/form.tsx (1)

352-359: Data attributes for element tracking are correctly implemented.

The data-ph-element attributes on both the "Save Changes" and "Deactivate Account" buttons are properly added using the standardized constants.

Also applies to: 384-390

web/core/components/profile/preferences/language-timezone.tsx (1)

2-2: Event tracking implementation is well-structured.

The tracking calls are properly placed within the success and error handlers for both timezone and language updates. The use of captureElementAndEvent effectively combines UI element tracking with business event tracking, and the payload structure is appropriate for each scenario.

Also applies to: 6-6, 22-33, 41-49, 60-71, 79-87

web/core/components/profile/start-of-week-preference.tsx (4)

6-10: LGTM! Clean import organization.

The tracking constants are properly imported and will provide type safety for the event tracking implementation.


14-14: Good addition of the event tracking helper.

The captureElementAndEvent import is correctly placed and necessary for the tracking functionality being added.


37-48: Excellent event tracking implementation for success case.

The tracking call is well-structured with:

  • Proper element identification using the constants
  • Meaningful payload including the updated value
  • Appropriate SUCCESS state indication
  • Good placement before user notification

This provides valuable analytics data for understanding user behavior.


56-64: Consistent error tracking implementation.

The error case tracking maintains consistency with the success case while appropriately excluding payload data. The ERROR state indication will help identify issues with profile updates.

@sriramveeraghanta sriramveeraghanta merged commit eb42394 into preview Jul 10, 2025
3 of 5 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-profile-settings-events branch July 10, 2025 11:32
@sriramveeraghanta sriramveeraghanta restored the chore-profile-settings-events branch July 10, 2025 11:34
@sriramveeraghanta sriramveeraghanta deleted the chore-profile-settings-events branch July 18, 2025 07:58
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* feat: event tracker helper

* feat: track click events for `data-ph-element`

* fix: handled click events

* fix: handled name

* chore: tracker element updates

* chore: remove export

* chore: tracker element type

* chore: track element and event helper.

* chore: minor improvements

* chore: minor refactors

* fix: workspace events

* fix: added slug

* fix: changes nomenclature

* fix: nomenclature

* chore: update event tracker helper types

* fix: data id

* refactor: cycle events (#7290)

* chore: update event tracker helper types

* refactor: cycle events

* refactor: cycle events

* refactor: cycle event tracker

* chore: update tracker elements

* chore: check for closest element with data-ph-element attribute

---------

Co-authored-by: Prateek Shourya <prateekshourya@Prateeks-MacBook-Pro.local>

* Refactor module events (#7291)

* chore: update event tracker helper types

* refactor: cycle events

* refactor: cycle events

* refactor: cycle event tracker

* refactor: module tracker event and element

* chore: update tracker element

* chore: revert unnecessary changes

---------

Co-authored-by: Prateek Shourya <prateekshourya@Prateeks-MacBook-Pro.local>

* refactor: global views, product tour, notifications, onboarding, users and sidebar related events

* chore: member tracker events (#7302)

* chore: member-tracker-events

* fix: constants

* refactor: update event tracker constants

* refactor: auth related event trackers (#7306)

* Chore: state events (#7307)

* chore: state events

* fix: refactor

* chore: project events (#7305)

* chore: project-events

* fix: refactor

* fix: removed hardcoded values

* fix: github redirection event

* chore: project page tracker events (#7304)

* added events for most page events

* refactor: simplify lock button event handling in PageLockControl

---------

Co-authored-by: Palanikannan M <akashmalinimurugu@gmail.com>
Co-authored-by: M. Palanikannan <73993394+Palanikannan1437@users.noreply.github.com>

* chore: minor cleanup and import fixes

* refactor: added tracker elements for buttons (#7308)

Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>

* fix: event type

* refactor: posthog group event

* chore: removed instances of event tracker (#7309)

* refactor: remove event tracker stores and hooks

* refactor: remove event tracker store

* fix: build errors

* clean up event tracker payloads

* chore: profile settings events

* fix: refactor

---------

Co-authored-by: Prateek Shourya <prateekshourya@Prateeks-MacBook-Pro.local>
Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
Co-authored-by: Palanikannan M <akashmalinimurugu@gmail.com>
Co-authored-by: M. Palanikannan <73993394+Palanikannan1437@users.noreply.github.com>
Co-authored-by: Vamsi Krishna <46787868+vamsikrishnamathala@users.noreply.github.com>
Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.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.

6 participants