mirror of
https://github.com/lukevella/rallly.git
synced 2025-08-06 09:59:00 +02:00
📈 Track paywall events
This commit is contained in:
parent
63725a0879
commit
9ff5d907a0
2 changed files with 10 additions and 1 deletions
|
@ -26,6 +26,7 @@ import { Trans } from "@/components/trans";
|
||||||
import { IfGuest, useUser } from "@/components/user-provider";
|
import { IfGuest, useUser } from "@/components/user-provider";
|
||||||
import { IfFreeUser } from "@/contexts/plan";
|
import { IfFreeUser } from "@/contexts/plan";
|
||||||
import { IconComponent } from "@/types";
|
import { IconComponent } from "@/types";
|
||||||
|
import { usePostHog } from "@/utils/posthog";
|
||||||
|
|
||||||
function NavItem({
|
function NavItem({
|
||||||
href,
|
href,
|
||||||
|
@ -60,6 +61,7 @@ function NavItem({
|
||||||
export function Sidebar() {
|
export function Sidebar() {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
|
const posthog = usePostHog();
|
||||||
return (
|
return (
|
||||||
<nav className="flex flex-1 flex-col ">
|
<nav className="flex flex-1 flex-col ">
|
||||||
<ul role="list" className="flex flex-1 flex-col gap-y-7">
|
<ul role="list" className="flex flex-1 flex-col gap-y-7">
|
||||||
|
@ -105,7 +107,12 @@ export function Sidebar() {
|
||||||
<IfFreeUser>
|
<IfFreeUser>
|
||||||
<li>
|
<li>
|
||||||
<PayWallDialog>
|
<PayWallDialog>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger
|
||||||
|
onClick={() =>
|
||||||
|
posthog?.capture("trigger paywall", { from: "sidebar" })
|
||||||
|
}
|
||||||
|
asChild
|
||||||
|
>
|
||||||
<button className="mb-4 flex w-full flex-col rounded-md border bg-gray-50 px-4 py-3 focus:border-gray-300 focus:bg-gray-200">
|
<button className="mb-4 flex w-full flex-col rounded-md border bg-gray-50 px-4 py-3 focus:border-gray-300 focus:bg-gray-200">
|
||||||
<span className="mb-2 flex items-center gap-x-2">
|
<span className="mb-2 flex items-center gap-x-2">
|
||||||
<SparklesIcon className="size-5 text-gray-400" />
|
<SparklesIcon className="size-5 text-gray-400" />
|
||||||
|
|
|
@ -210,6 +210,7 @@ const ManagePoll: React.FunctionComponent<{
|
||||||
paywallDialog.trigger();
|
paywallDialog.trigger();
|
||||||
posthog?.capture("trigger paywall", {
|
posthog?.capture("trigger paywall", {
|
||||||
poll_id: poll.id,
|
poll_id: poll.id,
|
||||||
|
from: "manage-poll",
|
||||||
action: "finalize",
|
action: "finalize",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -240,6 +241,7 @@ const ManagePoll: React.FunctionComponent<{
|
||||||
posthog?.capture("trigger paywall", {
|
posthog?.capture("trigger paywall", {
|
||||||
poll_id: poll.id,
|
poll_id: poll.id,
|
||||||
action: "duplicate",
|
action: "duplicate",
|
||||||
|
from: "manage-poll",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
duplicateDialog.trigger();
|
duplicateDialog.trigger();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue