📈 Track paywall events

This commit is contained in:
Luke Vella 2024-09-21 14:42:38 +01:00
parent 63725a0879
commit 9ff5d907a0
No known key found for this signature in database
GPG key ID: 469CAD687F0D784C
2 changed files with 10 additions and 1 deletions

View file

@ -26,6 +26,7 @@ import { Trans } from "@/components/trans";
import { IfGuest, useUser } from "@/components/user-provider";
import { IfFreeUser } from "@/contexts/plan";
import { IconComponent } from "@/types";
import { usePostHog } from "@/utils/posthog";
function NavItem({
href,
@ -60,6 +61,7 @@ function NavItem({
export function Sidebar() {
const pathname = usePathname();
const { user } = useUser();
const posthog = usePostHog();
return (
<nav className="flex flex-1 flex-col ">
<ul role="list" className="flex flex-1 flex-col gap-y-7">
@ -105,7 +107,12 @@ export function Sidebar() {
<IfFreeUser>
<li>
<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">
<span className="mb-2 flex items-center gap-x-2">
<SparklesIcon className="size-5 text-gray-400" />

View file

@ -210,6 +210,7 @@ const ManagePoll: React.FunctionComponent<{
paywallDialog.trigger();
posthog?.capture("trigger paywall", {
poll_id: poll.id,
from: "manage-poll",
action: "finalize",
});
} else {
@ -240,6 +241,7 @@ const ManagePoll: React.FunctionComponent<{
posthog?.capture("trigger paywall", {
poll_id: poll.id,
action: "duplicate",
from: "manage-poll",
});
} else {
duplicateDialog.trigger();