diff --git a/apps/web/package.json b/apps/web/package.json index 17392d97c..6e97f9596 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -64,7 +64,7 @@ "next-i18next": "^13.0.3", "php-serialize": "^4.1.1", "postcss": "^8.4.31", - "posthog-js": "^1.102.1", + "posthog-js": "^1.147.0", "posthog-node": "^3.6.0", "react-big-calendar": "^1.8.1", "react-hook-form": "^7.42.1", diff --git a/apps/web/src/components/create-poll.tsx b/apps/web/src/components/create-poll.tsx index 1299987e3..bb1e4be06 100644 --- a/apps/web/src/components/create-poll.tsx +++ b/apps/web/src/components/create-poll.tsx @@ -12,7 +12,7 @@ import { useRouter } from "next/navigation"; import React from "react"; import { useForm } from "react-hook-form"; import useFormPersist from "react-hook-form-persist"; -import { useUnmount } from "react-use"; +import { useMount, useUnmount } from "react-use"; import { PollSettingsForm } from "@/components/forms/poll-settings"; import { Trans } from "@/components/trans"; @@ -62,6 +62,10 @@ export const CreatePoll: React.FunctionComponent = () => { useUnmount(clear); + useMount(() => { + posthog?.startSessionRecording(); + }); + const posthog = usePostHog(); const queryClient = trpc.useUtils(); const createPoll = trpc.polls.create.useMutation({ diff --git a/apps/web/src/contexts/posthog.tsx b/apps/web/src/contexts/posthog.tsx index af8ffeb20..3d8cb069d 100644 --- a/apps/web/src/contexts/posthog.tsx +++ b/apps/web/src/contexts/posthog.tsx @@ -17,6 +17,9 @@ export function PostHogProvider(props: PostHogProviderProps) { api_host: process.env.NEXT_PUBLIC_POSTHOG_API_HOST, opt_out_capturing_by_default: false, capture_pageview: true, + // we use session recordings to offer support and + // improve the product for our pro users + disable_session_recording: true, persistence: "memory", capture_pageleave: false, autocapture: false, diff --git a/yarn.lock b/yarn.lock index c6f17ad7e..36e8c18dd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8006,9 +8006,9 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" -fflate@^0.4.1: +fflate@^0.4.8: version "0.4.8" - resolved "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz" + resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.4.8.tgz#f90b82aefbd8ac174213abb338bd7ef848f0f5ae" integrity sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA== file-entry-cache@^6.0.1: @@ -11182,13 +11182,14 @@ postgres-range@^1.1.1: resolved "https://registry.yarnpkg.com/postgres-range/-/postgres-range-1.1.4.tgz#a59c5f9520909bcec5e63e8cf913a92e4c952863" integrity sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w== -posthog-js@^1.102.1: - version "1.102.1" - resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.102.1.tgz#ac9e97703f4bba61785b1d1fa7f699516e97c6fb" - integrity sha512-vHkLtnjDce8qxoKX9K4HOWEvCW/xPTEzHDBJIPrhjWCfXLPa5NePEeSiQjr64BV4DFMBbvyNtUUPVstZoIqQcw== +posthog-js@^1.147.0: + version "1.147.0" + resolved "https://registry.yarnpkg.com/posthog-js/-/posthog-js-1.147.0.tgz#012b13a37044623d0d9bf1843ab3d37f916c8647" + integrity sha512-cALKIcix1W9xMsfUUI/QUFhtBeabDGsQCb3lpZEFd7WCPNLOcGmpeomm4xMX7MO2OnfK6Ov91/HNyfK1wncjSA== dependencies: - fflate "^0.4.1" + fflate "^0.4.8" preact "^10.19.3" + web-vitals "^4.0.1" posthog-node@^3.6.0: version "3.6.0" @@ -13698,6 +13699,11 @@ web-namespaces@^2.0.0: resolved "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz" integrity sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ== +web-vitals@^4.0.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-4.2.1.tgz#67eec387ddd0ef4c25574a01ab9dae723eee2b97" + integrity sha512-U6bAxeudnhDqcXNl50JC4hLlqox9DZnngxfISZm3DMZnonW35xtJOVUc091L+DOY+6hVZVpKXoiCP0RiT6339Q== + webcrypto-core@^1.7.4: version "1.7.6" resolved "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.7.6.tgz"