diff --git a/web/app/[locale]/(landing)/tracked-link.tsx b/web/app/[locale]/(landing)/tracked-link.tsx index f979b50b41c4..4f019df97d3b 100644 --- a/web/app/[locale]/(landing)/tracked-link.tsx +++ b/web/app/[locale]/(landing)/tracked-link.tsx @@ -1,7 +1,7 @@ "use client"; -import posthog from "posthog-js"; import { Link, usePathname } from "@/i18n/navigation"; +import { captureAnalyticsClick } from "../../lib/analytics"; // Localized internal link that records a PostHog click event, so we can see how // many clicks each guide / landing page gets and where they came from. @@ -21,7 +21,7 @@ export function TrackedLink({ posthog.capture(event, { target: href, from: pathname })} + onClick={() => captureAnalyticsClick(event, { target: href, from: pathname })} > {children} diff --git a/web/app/[locale]/components/download-button.tsx b/web/app/[locale]/components/download-button.tsx index 518e0f889327..26ea7afd8e50 100644 --- a/web/app/[locale]/components/download-button.tsx +++ b/web/app/[locale]/components/download-button.tsx @@ -2,9 +2,9 @@ import { Menu } from "@base-ui-components/react/menu"; import { useTranslations } from "next-intl"; -import posthog from "posthog-js"; import { useState } from "react"; import { Link, usePathname } from "../../../i18n/navigation"; +import { captureAnalyticsClick } from "../../lib/analytics"; import { DOWNLOAD_CONFIRMATION_HREF, DOWNLOAD_CONFIRMATION_PATH, @@ -91,7 +91,7 @@ export function DownloadButton({ "group flex items-center justify-center hover:bg-background/[0.04] dark:hover:bg-background/[0.03] data-[popup-open]:bg-background/[0.04] dark:data-[popup-open]:bg-background/[0.03]"; const captureMac = () => - posthog.capture("cmuxterm_download_clicked", { location, platform: "mac" }); + captureAnalyticsClick("cmuxterm_download_clicked", { location, platform: "mac" }); // The Apple mark artwork has an 814:1000 aspect ratio. Derive the box width // from its height so the glyph fills the frame instead of letterboxing inside @@ -194,7 +194,7 @@ export function DownloadButton({ } onClick={() => - posthog.capture("cmuxterm_download_clicked", { + captureAnalyticsClick("cmuxterm_download_clicked", { location, platform: "ios", }) @@ -214,7 +214,7 @@ export function DownloadButton({ { - posthog.capture("cmuxterm_waitlist_opened", { + captureAnalyticsClick("cmuxterm_waitlist_opened", { location, platform, }); diff --git a/web/app/[locale]/components/faq-platform-answer.tsx b/web/app/[locale]/components/faq-platform-answer.tsx index e8a52c8f0a71..dcaa1ca08319 100644 --- a/web/app/[locale]/components/faq-platform-answer.tsx +++ b/web/app/[locale]/components/faq-platform-answer.tsx @@ -1,8 +1,8 @@ "use client"; import { useTranslations } from "next-intl"; -import posthog from "posthog-js"; import { useState } from "react"; +import { captureAnalyticsClick } from "../../lib/analytics"; import { WaitlistDialog } from "./waitlist-dialog"; const LOCATION = "faq"; @@ -24,7 +24,7 @@ export function FaqPlatformAnswer({ linkClass }: { linkClass: string }) {