Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🔥 Remove low-value PostHog events to reduce costs (#2333)

Luke Vella3f8727b9bc32
diff --git a/apps/landing/src/components/home/hero.tsx b/apps/landing/src/components/home/hero.tsx
index ec94d2463..62a16e299 100644
--- a/apps/landing/src/components/home/hero.tsx
+++ b/apps/landing/src/components/home/hero.tsx
@@ -1,5 +1,4 @@
"use client";
-import { usePostHog } from "@rallly/posthog/client";
import { buttonVariants, cn } from "@rallly/ui";
import { Badge } from "@rallly/ui/badge";
import { ChevronRightIcon } from "lucide-react";
@@ -81,7 +80,6 @@ export const MarketingHero = ({
description: string;
callToAction: React.ReactNode;
}) => {
- const posthog = usePostHog();
return (
<article className="max-w-full space-y-12 text-center">
<header className="sm:p-8">
@@ -121,9 +119,6 @@ export const MarketingHero = ({
className:
"transition-all hover:shadow-md active:translate-y-1 active:shadow-none",
})}
- onClick={() => {
- posthog.capture("landing:hero_button_click");
- }}
>
{callToAction}
</Link>
diff --git a/apps/landing/src/components/login-button.tsx b/apps/landing/src/components/login-button.tsx
index 40043b445..d06188a04 100644
--- a/apps/landing/src/components/login-button.tsx
+++ b/apps/landing/src/components/login-button.tsx
@@ -1,20 +1,15 @@
"use client";
-import { usePostHog } from "@rallly/posthog/client";
import { buttonVariants } from "@rallly/ui";
import Link from "next/link";
import { Trans } from "@/i18n/client/trans";
import { linkToApp } from "@/lib/linkToApp";
export const LoginButton = () => {
- const posthog = usePostHog();
return (
<Link
href={linkToApp("/login")}
className={buttonVariants({ variant: "ghost" })}
- onClick={() => {
- posthog.capture("landing:login_button_click");
- }}
>
<Trans i18nKey="login" defaults="Login" />
</Link>
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/components/feedback-menu-item.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/components/feedback-menu-item.tsx
index 4a4bf6d64..8d38792da 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/components/feedback-menu-item.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/components/feedback-menu-item.tsx
@@ -1,6 +1,5 @@
"use client";
-import { usePostHog } from "@rallly/posthog/client";
import { useDialog } from "@rallly/ui/dialog";
import { SidebarMenuButton, SidebarMenuItem } from "@rallly/ui/sidebar";
import { MegaphoneIcon } from "lucide-react";
@@ -9,14 +8,12 @@ import { Trans } from "@/i18n/client";
export function FeedbackMenuItem() {
const dialog = useDialog();
- const posthog = usePostHog();
return (
<>
<SidebarMenuItem>
<SidebarMenuButton
{...dialog.triggerProps}
onClick={() => {
- posthog?.capture("space_sidebar:feedback_menu_item_click");
dialog.trigger();
}}
>
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/password-setup-alert.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/password-setup-alert.tsx
index 9ffe90761..dfb78e406 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/password-setup-alert.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/password-setup-alert.tsx
@@ -1,5 +1,4 @@
"use client";
-import { usePostHog } from "@rallly/posthog/client";
import { buttonVariants } from "@rallly/ui";
import { Alert, AlertDescription, AlertTitle } from "@rallly/ui/alert";
import { Button } from "@rallly/ui/button";
@@ -20,7 +19,6 @@ function PasswordSetupAlertInner() {
const [dismissed, setDismissed] = useLocalStorage<string>(
"password_setup_dismissed",
);
- const posthog = usePostHog();
return (
<AnimatePresence initial={true}>
@@ -50,11 +48,6 @@ function PasswordSetupAlertInner() {
<Link
href="/settings/security"
className={buttonVariants({ variant: "primary" })}
- onClick={() => {
- posthog.capture(
- "space_dashboard:password_setup_button_click",
- );
- }}
>
<Trans
i18nKey="setupPasswordButton"
@@ -65,7 +58,6 @@ function PasswordSetupAlertInner() {
variant="ghost"
onClick={() => {
setDismissed("1");
- posthog.capture("space_dashboard:password_setup_dismissed");
}}
>
<Trans
diff --git a/apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx b/apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx
index 06b39cb86..d254a26a0 100644
--- a/apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx
@@ -1,6 +1,5 @@
"use client";
-import { usePostHog } from "@rallly/posthog/client";
import { useRouter } from "next/navigation";
import {
ImageUpload,
@@ -19,7 +18,6 @@ function ProfilePictureUpload({
name: string;
}) {
const router = useRouter();
- const posthog = usePostHog();
const getAvatarUploadUrl = trpc.user.getAvatarUploadUrl.useMutation();
const updateAvatar = trpc.user.updateAvatar.useMutation();
@@ -28,13 +26,11 @@ function ProfilePictureUpload({
const handleUploadSuccess = async (imageKey: string) => {
await updateAvatar.mutateAsync({ imageKey });
router.refresh();
- posthog?.capture("upload profile picture");
};
const handleRemoveSuccess = async () => {
await removeAvatar.mutateAsync();
router.refresh();
- posthog?.capture("remove profile picture");
};
return (
diff --git a/apps/web/src/app/[locale]/timezone-change-detector.tsx b/apps/web/src/app/[locale]/timezone-change-detector.tsx
index 24381733a..bd4dc5b6f 100644
--- a/apps/web/src/app/[locale]/timezone-change-detector.tsx
+++ b/apps/web/src/app/[locale]/timezone-change-detector.tsx
@@ -1,4 +1,3 @@
-import { usePostHog } from "@rallly/posthog/client";
import { Button } from "@rallly/ui/button";
import {
Dialog,
@@ -36,17 +35,11 @@ export function TimeZoneChangeDetector({
return timeZone;
});
- const posthog = usePostHog();
-
React.useEffect(() => {
if (previousTimeZone !== currentTimeZone) {
- posthog?.capture("timezone change detected", {
- previousTimeZone,
- currentTimeZone,
- });
setOpen(true);
}
- }, [previousTimeZone, currentTimeZone, posthog]);
+ }, [previousTimeZone, currentTimeZone]);
return (
<Dialog open={open} onOpenChange={setOpen}>
@@ -74,10 +67,6 @@ export function TimeZoneChangeDetector({
safeLocalStorage.setItem("previousTimeZone", currentTimeZone);
onTimeZoneChange?.(currentTimeZone);
setOpen(false);
- posthog?.capture("timezone change accepted", {
- previousTimeZone,
- currentTimeZone,
- });
}}
>
<Trans
@@ -90,10 +79,6 @@ export function TimeZoneChangeDetector({
setPreviousTimeZone(currentTimeZone);
safeLocalStorage.setItem("previousTimeZone", currentTimeZone);
setOpen(false);
- posthog?.capture("timezone change rejected", {
- previousTimeZone,
- currentTimeZone,
- });
}}
>
<Trans
diff --git a/apps/web/src/components/participant-dropdown.tsx b/apps/web/src/components/participant-dropdown.tsx
index 82c86e663..6ab3aa13a 100644
--- a/apps/web/src/components/participant-dropdown.tsx
+++ b/apps/web/src/components/participant-dropdown.tsx
@@ -1,5 +1,4 @@
import { zodResolver } from "@hookform/resolvers/zod";
-import { usePostHog } from "@rallly/posthog/client";
import { Button } from "@rallly/ui/button";
import {
Dialog,
@@ -194,17 +193,8 @@ const ChangeNameModal = (props: {
open: boolean;
onOpenChange: (open: boolean) => void;
}) => {
- const posthog = usePostHog();
const token = useEditToken();
- const changeName = trpc.polls.participants.rename.useMutation({
- onSuccess: (_, { participantId, newName }) => {
- posthog?.capture("changed name", {
- participantId,
- oldName: props.oldName,
- newName,
- });
- },
- });
+ const changeName = trpc.polls.participants.rename.useMutation();
const form = useForm({
defaultValues: {
name: props.oldName,
diff --git a/apps/web/src/components/upgrade-button.tsx b/apps/web/src/components/upgrade-button.tsx
index 4349e496c..41f2abb1b 100644
--- a/apps/web/src/components/upgrade-button.tsx
+++ b/apps/web/src/components/upgrade-button.tsx
@@ -1,5 +1,4 @@
"use client";
-import { usePostHog } from "@rallly/posthog/client";
import { Button } from "@rallly/ui/button";
import React from "react";
@@ -13,7 +12,6 @@ export const UpgradeButton = ({
annual?: boolean;
className?: string;
}>) => {
- const posthog = usePostHog();
const formRef = React.useRef<HTMLFormElement>(null);
return (
@@ -39,7 +37,6 @@ export const UpgradeButton = ({
// TODO: Fix this by making sure we never have nested forms.
e.preventDefault();
formRef.current?.submit();
- posthog?.capture("click upgrade button");
}}
>
{children || <Trans i18nKey="upgradeToPro" defaults="Upgrade to Pro" />}
diff --git a/apps/web/src/features/theme/client.tsx b/apps/web/src/features/theme/client.tsx
index 4d715f23c..5e9025ecd 100644
--- a/apps/web/src/features/theme/client.tsx
+++ b/apps/web/src/features/theme/client.tsx
@@ -1,6 +1,5 @@
"use client";
-import { usePostHog } from "@rallly/posthog/client";
import {
ThemeProvider,
useTheme as useNextTheme,
@@ -10,17 +9,14 @@ import React from "react";
export const useTheme = () => {
const { theme, setTheme } = useNextTheme();
- const posthog = usePostHog();
-
return React.useMemo(
() => ({
theme,
setTheme: (theme: string) => {
setTheme(theme);
- posthog?.capture("theme_change", { theme });
},
}),
- [theme, setTheme, posthog],
+ [theme, setTheme],
);
};