Skip to content

Commit 3d2c18f

Browse files
committed
docs: update analytics event tracking
1 parent a87ac38 commit 3d2c18f

File tree

2 files changed

+48
-12
lines changed

2 files changed

+48
-12
lines changed

docs/app/pricing/tiers.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,55 @@ function TierCTAButton({ tier }: { tier: Tier }) {
7272
return (
7373
<a
7474
onClick={async (e) => {
75+
// This event is deprecated, but we keep it to use as a baseline for analytics
76+
track("Signup", { tier: tier.id });
77+
7578
if (!session) {
79+
Sentry.captureEvent({
80+
message: "click-pricing-signup",
81+
level: "info",
82+
extra: {
83+
tier: tier.id,
84+
},
85+
});
86+
track("click-pricing-signup", { tier: tier.id });
7687
return;
7788
}
7889

7990
if (session.planType === "free") {
8091
Sentry.captureEvent({
81-
message: "Checkout",
92+
message: "click-pricing-buy-now",
8293
level: "info",
8394
extra: {
8495
tier: tier.id,
8596
},
8697
});
87-
track("Checkout", { tier: tier.id });
98+
track("click-pricing-buy-now", { tier: tier.id });
8899
e.preventDefault();
89100
e.stopPropagation();
90101
await authClient.checkout({
91102
slug: tier.id,
92103
});
93104
} else {
105+
if (session.planType === tier.id) {
106+
Sentry.captureEvent({
107+
message: "click-pricing-manage-subscription",
108+
level: "info",
109+
extra: {
110+
tier: tier.id,
111+
},
112+
});
113+
track("click-pricing-manage-subscription", { tier: tier.id });
114+
} else {
115+
Sentry.captureEvent({
116+
message: "click-pricing-update-subscription",
117+
level: "info",
118+
extra: {
119+
tier: tier.id,
120+
},
121+
});
122+
track("click-pricing-update-subscription", { tier: tier.id });
123+
}
94124
e.preventDefault();
95125
e.stopPropagation();
96126
await authClient.customer.portal();

docs/components/AuthenticationPage.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ function AuthenticationBox(props: {
7171
setSigningInState({ state: "loading" });
7272

7373
if (props.variant === "password") {
74-
track("Sign In", { type: "password" });
74+
track("click-sign-in", { type: "password" });
7575
Sentry.captureEvent({
76-
message: "Sign In",
76+
message: "click-sign-in",
7777
level: "info",
7878
extra: {
7979
type: "password",
@@ -98,9 +98,9 @@ function AuthenticationBox(props: {
9898
},
9999
);
100100
} else if (props.variant === "email") {
101-
track("Sign In", { type: "magic-link" });
101+
track("click-sign-in", { type: "magic-link" });
102102
Sentry.captureEvent({
103-
message: "Sign In",
103+
message: "click-sign-in",
104104
level: "info",
105105
extra: {
106106
type: "magic-link",
@@ -135,9 +135,9 @@ function AuthenticationBox(props: {
135135
},
136136
);
137137
} else {
138-
track("Create Account");
138+
track("click-sign-up", { type: "email" });
139139
Sentry.captureEvent({
140-
message: "Sign Up",
140+
message: "click-sign-up",
141141
level: "info",
142142
extra: {
143143
type: "email",
@@ -323,7 +323,9 @@ function PasswordSignInButton() {
323323
);
324324
}
325325

326-
function GitHubSignInButton() {
326+
function GitHubSignInButton(props: {
327+
variant: "password" | "register" | "email";
328+
}) {
327329
const searchParams = useSearchParams();
328330
const callbackURL = searchParams?.get("redirect") || "/";
329331

@@ -345,9 +347,13 @@ function GitHubSignInButton() {
345347
</svg>
346348
}
347349
onClick={async () => {
348-
track("Sign In", { type: "github" });
350+
track(
351+
props.variant === "register" ? "click-sign-up" : "click-sign-in",
352+
{ type: "github" },
353+
);
349354
Sentry.captureEvent({
350-
message: "Sign In",
355+
message:
356+
props.variant === "register" ? "click-sign-up" : "click-sign-in",
351357
level: "info",
352358
extra: {
353359
type: "github",
@@ -380,7 +386,7 @@ function AlternativeSignInBox(props: {
380386
<div className="mt-6 flex flex-col gap-4">
381387
{props.variant === "email" && <PasswordSignInButton />}
382388
{props.variant === "password" && <EmailSignInButton />}
383-
<GitHubSignInButton />
389+
<GitHubSignInButton variant={props.variant} />
384390
</div>
385391
</div>
386392
);

0 commit comments

Comments
 (0)