-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: track new landing_v2 features (wip) #1212
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request updates the tracking functionality and Mixpanel integration. In the tracking service, additional console log statements have been added to the getter and the Changes
Sequence Diagram(s)sequenceDiagram
participant UI as User Interface
participant TS as TrackingService
participant MP as Mixpanel Library
UI->>TS: Trigger dropdown open event
TS->>TS: Execute onDropDownOpen(trackingApp)
TS->>TS: Call eventTrack("Dropdown Open", trackingApp)
TS->>TS: Log pre-tracking action and properties
TS->>MP: Send tracking data to Mixpanel
TS->>TS: Log successful tracking completion
Suggested labels
Suggested reviewers
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
PR description must contain a link to a ClickUp (case-insensitive) |
|
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.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/app/core/services/integration/tracking.service.ts
(3 hunks)src/index.html
(1 hunks)
🧰 Additional context used
🪛 ESLint
src/app/core/services/integration/tracking.service.ts
[error] 58-58: Unexpected console statement.
(no-console)
[error] 68-68: Unexpected console statement.
(no-console)
[error] 72-72: Unexpected console statement.
(no-console)
🪛 GitHub Check: lint
src/app/core/services/integration/tracking.service.ts
[failure] 58-58:
Unexpected console statement
[failure] 68-68:
Unexpected console statement
[failure] 72-72:
Unexpected console statement
🪛 GitHub Actions: TypeScript Lint Check
src/app/core/services/integration/tracking.service.ts
[error] 58-58: ESLint: Unexpected console statement (no-console)
🪛 Gitleaks (8.21.2)
src/index.html
13-13: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: staging_deploy
- GitHub Check: unit-test
🔇 Additional comments (2)
src/app/core/services/integration/tracking.service.ts (1)
131-133
: LGTM - Implementation aligns with PR objectiveThe new method properly tracks dropdown open events as described in the PR objectives.
src/index.html (1)
14-14
: LGTM - Explicit URL declarationDefining the library URL as a constant is a good practice for ensuring consistent library loading.
@@ -64,9 +65,11 @@ | |||
...flattenedObject, | |||
Asset: 'Integration Settings Web' | |||
}; | |||
console.log('attempting:', action, properties); |
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.
Remove console log statements
These debugging statements should be removed before merging to production. They violate the ESLint no-console rule and have caused pipeline failures.
- console.log('attempting:', action, properties);
try {
if (this.tracking) {
this.tracking.track(`${trackingApp ? trackingApp : 'Integration Settings Web'}: ${action}`, properties);
- console.log(`tracked: ${trackingApp ? trackingApp : 'Integration Settings Web'}: ${action}`, properties);
}
} catch (e) {
Also applies to: 72-72
🧰 Tools
🪛 ESLint
[error] 68-68: Unexpected console statement.
(no-console)
🪛 GitHub Check: lint
[failure] 68-68:
Unexpected console statement
get tracking() { | ||
console.log('got', (window as any).mixpanel); | ||
return (window as any).mixpanel; | ||
} |
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.
Remove console log statement
This debug console log should be removed before merging to production as it violates the ESLint no-console rule and has caused pipeline failures.
get tracking() {
- console.log('got', (window as any).mixpanel);
return (window as any).mixpanel;
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
get tracking() { | |
console.log('got', (window as any).mixpanel); | |
return (window as any).mixpanel; | |
} | |
get tracking() { | |
return (window as any).mixpanel; | |
} |
🧰 Tools
🪛 ESLint
[error] 58-58: Unexpected console statement.
(no-console)
🪛 GitHub Check: lint
[failure] 58-58:
Unexpected console statement
🪛 GitHub Actions: TypeScript Lint Check
[error] 58-58: ESLint: Unexpected console statement (no-console)
@@ -8,12 +8,13 @@ | |||
|
|||
<!-- Mixpanel --> | |||
<script type="text/javascript"> | |||
if (window.location.hostname !== "localhost") { | |||
if (true) { |
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.
Enable tracking only in production environments
Using if (true)
enables Mixpanel tracking in all environments including localhost, which can pollute analytics with development data. Consider using environment-specific conditions instead.
- if (true) {
+ if (window.location.hostname !== "localhost") {
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if (true) { | |
if (window.location.hostname !== "localhost") { |
const MIXPANEL_PROJECT_TOKEN = 'dce787f3a74f5ede8264af230a4b4652'; | ||
const MIXPANEL_CUSTOM_LIB_URL = 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'; |
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.
💡 Verification agent
🧩 Analysis chain
Avoid hardcoding Mixpanel token in source code
Hardcoding API tokens in the source code is a security risk and could potentially be misused. The static analysis has flagged this as a generic API key leak.
Consider using environment variables or a secure configuration approach instead:
- const MIXPANEL_PROJECT_TOKEN = 'dce787f3a74f5ede8264af230a4b4652';
+ const MIXPANEL_PROJECT_TOKEN = '{{MIXPANEL_PROJECT_TOKEN}}';
🏁 Script executed:
#!/bin/bash
# Check if this Mixpanel token is referenced elsewhere in a more secure way
rg -g "!node_modules" -g "!dist" -g "!*.js.map" "dce787f3a74f5ede8264af230a4b4652" --no-ignore-vcs
# Check if there's an environment-based token loading pattern elsewhere in the codebase
rg -g "!node_modules" -g "!dist" -g "!*.js.map" "MIXPANEL_PROJECT_TOKEN" --no-ignore-vcs
Length of output: 527
Action: Secure Mixpanel Token Configuration
- In src/index.html (lines 13-14), the Mixpanel project token is hardcoded, exposing a sensitive value.
- The substitution in run.sh expects a placeholder (
{{MIXPANEL_PROJECT_TOKEN}}
) to inject the secure token at build time. - Please update the code so that the token is defined as a placeholder, as shown below:
- const MIXPANEL_PROJECT_TOKEN = 'dce787f3a74f5ede8264af230a4b4652';
+ const MIXPANEL_PROJECT_TOKEN = '{{MIXPANEL_PROJECT_TOKEN}}';
Implementing this change mitigates the security risk of a hardcoded API key.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const MIXPANEL_PROJECT_TOKEN = 'dce787f3a74f5ede8264af230a4b4652'; | |
const MIXPANEL_CUSTOM_LIB_URL = 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'; | |
const MIXPANEL_PROJECT_TOKEN = '{{MIXPANEL_PROJECT_TOKEN}}'; | |
const MIXPANEL_CUSTOM_LIB_URL = 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'; |
🧰 Tools
🪛 Gitleaks (8.21.2)
13-13: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
@@ -8,12 +8,13 @@ | |||
|
|||
<!-- Mixpanel --> | |||
<script type="text/javascript"> | |||
if (window.location.hostname !== "localhost") { |
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.
pls revert all these file changes
@@ -124,4 +127,8 @@ export class TrackingService { | |||
onErrorResolve(trackingApp: TrackingApp, properties: ResolveMappingErrorProperty): void { | |||
this.eventTrack('Resolve Mapping Error', trackingApp, properties); | |||
} | |||
|
|||
onDropDownOpen(trackingApp: TrackingApp): void { |
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.
I don't see any caller to this
@@ -55,6 +55,7 @@ export class TrackingService { | |||
} | |||
|
|||
get tracking() { | |||
console.log('got', (window as any).mixpanel); |
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.
fix all linting issues
Description
Tracks:
Clickup
https://app.clickup.com/t/86cy8ykmx
Summary by CodeRabbit