-
Notifications
You must be signed in to change notification settings - Fork 10.8k
feat: posthog version upgrade and calai banner tracking #24401
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis change updates PostHog dependencies (posthog-js to ^1.274.1 and posthog-node to ^5.9.5), removes the PostHog initialization option persistence: "memory", and adds analytics event capture across several UI components. BuyNumberDialog now captures calai_phone_number_purchased on successful purchase and calai_buy_number_button_clicked with agentId, workflowId, and teamId on click. PhoneNumberTab captures a Buy button click event when not readOnly. CalAiBanner captures events on banner dismissal and on “Try Now.” No exported/public API changes were made. Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || "https://us.i.posthog.com", | ||
autocapture: false, | ||
person_profiles: "never", | ||
persistence: "memory", |
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.
Incase of memory
, it tracks as a different person every time you refresh the page/open in new tab. Not good for analysing funnels / tracking movements.
now it stores it as localStorage + cookie
.
For more info: https://posthog.com/docs/libraries/js/persistence
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: 1
🧹 Nitpick comments (2)
packages/features/ee/workflows/components/agent-configuration/components/dialogs/BuyNumberDialog.tsx (1)
31-31
: Consider capturing context with the purchase event.The purchase success event currently doesn't include context properties like
agentId
,workflowId
, andteamId
, which could be valuable for analytics and understanding the purchase flow. These properties are available in the component and are captured in the button click event (line 122).Apply this diff to add context to the purchase event:
- posthog.capture("calai_phone_number_purchased"); + posthog.capture("calai_phone_number_purchased", { agentId, workflowId, teamId });packages/features/ee/workflows/components/agent-configuration/components/tabs/PhoneNumberTab.tsx (1)
279-283
: Consider capturing context with the modal opened event.For consistency with the
calai_buy_number_button_clicked
event in BuyNumberDialog.tsx (line 122) and to provide better analytics insights, consider capturingagentId
,workflowId
, andteamId
with this event as well. These properties are available in the component scope.Apply this diff to add context:
- posthog.capture("calai_buy_number_modal_opened"); + posthog.capture("calai_buy_number_modal_opened", { agentId, workflowId, teamId });
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (5)
apps/web/package.json
(1 hunks)packages/features/ee/event-tracking/lib/posthog/provider.tsx
(0 hunks)packages/features/ee/workflows/components/agent-configuration/components/dialogs/BuyNumberDialog.tsx
(3 hunks)packages/features/ee/workflows/components/agent-configuration/components/tabs/PhoneNumberTab.tsx
(2 hunks)packages/features/shell/CalAiBanner.tsx
(2 hunks)
💤 Files with no reviewable changes (1)
- packages/features/ee/event-tracking/lib/posthog/provider.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Always use
t()
for text localization in frontend code; direct text embedding should trigger a warning
Files:
packages/features/shell/CalAiBanner.tsx
packages/features/ee/workflows/components/agent-configuration/components/dialogs/BuyNumberDialog.tsx
packages/features/ee/workflows/components/agent-configuration/components/tabs/PhoneNumberTab.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()
in hot paths like loops
Files:
packages/features/shell/CalAiBanner.tsx
packages/features/ee/workflows/components/agent-configuration/components/dialogs/BuyNumberDialog.tsx
packages/features/ee/workflows/components/agent-configuration/components/tabs/PhoneNumberTab.tsx
**/*.{ts,tsx,js,jsx}
⚙️ CodeRabbit configuration file
Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.
Files:
packages/features/shell/CalAiBanner.tsx
packages/features/ee/workflows/components/agent-configuration/components/dialogs/BuyNumberDialog.tsx
packages/features/ee/workflows/components/agent-configuration/components/tabs/PhoneNumberTab.tsx
🧬 Code graph analysis (1)
packages/features/shell/CalAiBanner.tsx (1)
packages/lib/webstorage.ts (1)
localStorage
(6-36)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Install dependencies / Yarn install & cache
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (4)
packages/features/shell/CalAiBanner.tsx (1)
4-4
: LGTM! Analytics tracking added for banner interactions.The PostHog event tracking is correctly implemented for the banner dismissal and "Try Now" actions. The event names follow a consistent naming convention with the
calai_
prefix.Also applies to: 20-20, 26-26
packages/features/ee/workflows/components/agent-configuration/components/dialogs/BuyNumberDialog.tsx (2)
1-2
: LGTM! PostHog import added.
122-122
: LGTM! Button click event properly captures context.The event correctly includes
agentId
,workflowId
, andteamId
for analytics tracking, and it's appropriately guarded by the conditional check on lines 119-121.packages/features/ee/workflows/components/agent-configuration/components/tabs/PhoneNumberTab.tsx (1)
1-1
: LGTM! PostHog import added.
E2E results are ready! |
TODO before merge/release
NEXT_PUBLIC_POSTHOG_KEY
NEXT_PUBLIC_POSTHOG_HOST
What does this PR do?
Upgrades the posthog package and adds tracking for cal.ai banner.
Mandatory Tasks (DO NOT REMOVE)