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