From d778f61f33ea50272eb155c0df80678565b00a8d Mon Sep 17 00:00:00 2001 From: MarconLP <13001502+MarconLP@users.noreply.github.com> Date: Sun, 23 Apr 2023 16:53:14 +0200 Subject: [PATCH] add paywall events --- src/components/Paywall.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/Paywall.tsx b/src/components/Paywall.tsx index 6c73dc0..3b13e40 100644 --- a/src/components/Paywall.tsx +++ b/src/components/Paywall.tsx @@ -7,6 +7,7 @@ import { api } from "~/utils/api"; import { useRouter } from "next/router"; import { CheckIcon } from "@heroicons/react/20/solid"; import Tooltip from "~/components/Tooltip"; +import { usePostHog } from "posthog-js/react"; export default function Paywall() { const { mutateAsync: createCheckoutSession } = @@ -14,9 +15,12 @@ export default function Paywall() { const router = useRouter(); const [open, setOpen] = useAtom(paywallAtom); const [billedAnnually, setBilledAnnually] = useState(false); + const posthog = usePostHog(); function closeModal() { setOpen(false); + + posthog?.capture("close paywall"); } const handleCheckout = async () => { @@ -26,6 +30,12 @@ export default function Paywall() { } }; + const toggleBillingCycle = () => { + setBilledAnnually(!billedAnnually); + + posthog?.capture("change billing cycle"); + }; + return ( @@ -85,7 +95,7 @@ export default function Paywall() { Monthly