Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@
"nuqs": "^1.20.0",
"openid-client": "6.5.0",
"otplib": "^12.0.1",
"posthog-js": "^1.164.1",
"posthog-node": "^4.2.0",
"posthog-js": "^1.274.1",
"posthog-node": "^5.9.5",
"qrcode": "^1.5.1",
"raw-body": "^2.5.1",
"react": "^18.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function Provider({ children }: { children: React.ReactNode }) {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || "https://us.i.posthog.com",
autocapture: false,
person_profiles: "never",
persistence: "memory",
Copy link
Contributor Author

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

request_batching: true,
capture_pageview: false,
capture_pageleave: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import posthog from "posthog-js";

import { CAL_AI_PHONE_NUMBER_MONTHLY_PRICE } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
Expand Down Expand Up @@ -26,6 +28,7 @@ export function BuyNumberDialog({ open, onOpenChange, agentId, workflowId, teamI
window.location.href = data.checkoutUrl;
} else if (data.phoneNumber) {
showToast(t("phone_number_purchased_successfully"), "success");
posthog.capture("calai_phone_number_purchased");
await utils.viewer.me.get.invalidate();
onOpenChange(false);
if (agentId) {
Expand Down Expand Up @@ -116,6 +119,7 @@ export function BuyNumberDialog({ open, onOpenChange, agentId, workflowId, teamI
if (!agentId || !workflowId) {
return;
}
posthog.capture("calai_buy_number_button_clicked", { agentId, workflowId, teamId });
buyNumberMutation.mutate({
agentId: agentId,
workflowId: workflowId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import posthog from "posthog-js";
import { useState } from "react";
import type { UseFormReturn } from "react-hook-form";

Expand Down Expand Up @@ -277,6 +278,7 @@ export function PhoneNumberTab({
<Button
onClick={() => {
if (readOnly) return;
posthog.capture("calai_buy_number_modal_opened");
setIsBuyDialogOpen(true);
}}
StartIcon="external-link"
Expand Down
3 changes: 3 additions & 0 deletions packages/features/shell/CalAiBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import { usePathname } from "next/navigation";
import posthog from "posthog-js";
import { useState } from "react";

import { useLocale } from "@calcom/lib/hooks/useLocale";
Expand All @@ -16,11 +17,13 @@ export function CalAiBanner() {
});

const handleDismiss = () => {
posthog.capture("calai_banner_dismissed");
localStorage.setItem("calai-banner-dismissed", "true");
setIsVisible(false);
};

const handleTryNow = () => {
posthog.capture("calai_banner_try_now_clicked");
window.open("/workflow/new?action=calAi&templateWorkflowId=wf-11", "_blank");
};

Expand Down
49 changes: 32 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4375,8 +4375,8 @@ __metadata:
openid-client: 6.5.0
otplib: ^12.0.1
postcss: ^8.4.18
posthog-js: ^1.164.1
posthog-node: ^4.2.0
posthog-js: ^1.274.1
posthog-node: ^5.9.5
qrcode: ^1.5.1
raw-body: ^2.5.1
react: ^18.2.0
Expand Down Expand Up @@ -11485,6 +11485,13 @@ __metadata:
languageName: node
linkType: hard

"@posthog/core@npm:1.2.4":
version: 1.2.4
resolution: "@posthog/core@npm:1.2.4"
checksum: e6d89de66338c69ea6b5c6c90cfbae23005bb4ce5c7fbf95e5d43ad73a382206f43c429a433c34d683904f750d7e210626c9d0d33ab4cfdf931241b3a61312eb
languageName: node
linkType: hard

"@prettier/sync@npm:^0.6.1":
version: 0.6.1
resolution: "@prettier/sync@npm:0.6.1"
Expand Down Expand Up @@ -39776,25 +39783,24 @@ __metadata:
languageName: node
linkType: hard

"posthog-js@npm:^1.164.1":
version: 1.181.0
resolution: "posthog-js@npm:1.181.0"
"posthog-js@npm:^1.274.1":
version: 1.274.1
resolution: "posthog-js@npm:1.274.1"
dependencies:
"@posthog/core": 1.2.4
core-js: ^3.38.1
fflate: ^0.4.8
preact: ^10.19.3
web-vitals: ^4.2.0
checksum: e48b53844701c9db6c3c3da7af3f251e04e1572a1079c673e7302452c84e0f0e27c4b6b22ddb215afc1996a7f091b69218e927f83d7c0c18f7f7463fef06ee1a
languageName: node
linkType: hard

"posthog-node@npm:^4.2.0":
version: 4.2.1
resolution: "posthog-node@npm:4.2.1"
dependencies:
axios: ^1.7.4
rusha: ^0.8.14
checksum: f6871399069f329cd4d4c156e82a59c7ab222229d6f49fb62159738f0161a170d723b6707c229af2ca91ba3674f3bb243759d1a615333c23bec188b8122d35ab
web-vitals: ^4.2.4
peerDependencies:
"@rrweb/types": 2.0.0-alpha.17
rrweb-snapshot: 2.0.0-alpha.17
peerDependenciesMeta:
"@rrweb/types":
optional: true
rrweb-snapshot:
optional: true
checksum: 606d0843c7a7b30917fc89668bda7b6e731b688e1d9bd13b93b335030ad9dea862a0b0dcc806900b43bdb9ebc1fdc616d9f870ab7b0ab0d261da494fec5c85b3
languageName: node
linkType: hard

Expand All @@ -39807,6 +39813,15 @@ __metadata:
languageName: node
linkType: hard

"posthog-node@npm:^5.9.5":
version: 5.9.5
resolution: "posthog-node@npm:5.9.5"
dependencies:
"@posthog/core": 1.2.4
checksum: 5f7f316e49bb79c561c8ea8e7f084f9bf5bd07988948c5edd3ad5cb689e8f91417b34c6e6ee011ecb44edb6ce85a89128119ec4b71cf15647d524459f62b11bd
languageName: node
linkType: hard

"preact-render-to-string@npm:^5.1.19":
version: 5.2.6
resolution: "preact-render-to-string@npm:5.2.6"
Expand Down
Loading