Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions apps/web/app/app.dub.co/(dashboard)/[slug]/links/page-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,12 @@ import {
useRouterStuff,
} from "@dub/ui";
import { Download, Globe, TableIcon, Tag } from "@dub/ui/icons";
import { useSession } from "next-auth/react";
import { useRouter, useSearchParams } from "next/navigation";
import posthog from "posthog-js";
import { ReactNode, useEffect, useState } from "react";

export default function WorkspaceLinksClient() {
const { data: session } = useSession();
const { folderId } = useCurrentFolderId();

useEffect(() => {
if (session?.user) {
posthog.identify(session.user["id"], {
email: session.user.email,
name: session.user.name,
});
}
}, [session?.user]);

return (
<PageContentWithSidePanel
title={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { mutatePrefix } from "@/lib/swr/mutate";
import { Button, useKeyboardShortcut } from "@dub/ui";
import { useSession } from "next-auth/react";
import { useParams, useRouter } from "next/navigation";
import posthog from "posthog-js";
import { useState } from "react";
import { toast } from "sonner";

Expand All @@ -31,17 +30,6 @@ export function AcceptInviteButton() {
return;
}

if (session?.user) {
posthog.identify(session.user["id"], {
email: session.user.email,
name: session.user.name,
});
}

posthog.capture("accepted_workspace_invite", {
workspace: slug,
});

await mutatePrefix(["/api/workspaces", "/api/programs"]);
router.replace(`/${slug}`);
toast.success("You now are a part of this workspace!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { useSession } from "next-auth/react";
import { usePlausible } from "next-plausible";
import posthog from "posthog-js";
import { useEffect } from "react";

export default function TrackSignup() {
Expand All @@ -11,13 +10,6 @@ export default function TrackSignup() {

useEffect(() => {
plausible("Signed Up");
if (session?.user) {
posthog.identify(session.user["id"], {
email: session.user.email,
name: session.user.name,
});
posthog.capture("user_signed_up");
}
}, [session?.user]);

return null;
Expand Down
53 changes: 16 additions & 37 deletions apps/web/app/providers.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,28 @@
"use client";

import { PosthogPageview } from "@/ui/layout/posthog-pageview";
import { Analytics as DubAnalytics } from "@dub/analytics/react";
import {
KeyboardShortcutProvider,
TooltipProvider,
useRemoveGAParams,
} from "@dub/ui";
import { KeyboardShortcutProvider, TooltipProvider } from "@dub/ui";
import PlausibleProvider from "next-plausible";
import posthog from "posthog-js";
import { PostHogProvider } from "posthog-js/react";
import { ReactNode } from "react";
import { Toaster } from "sonner";

if (typeof window !== "undefined" && process.env.NEXT_PUBLIC_POSTHOG_KEY) {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
ui_host: "https://us.posthog.com",
person_profiles: "identified_only",
capture_pageview: false, // Disable automatic pageview capture, as we capture manually
capture_pageleave: true, // Enable pageleave capture
});
}

export default function RootProviders({ children }: { children: ReactNode }) {
useRemoveGAParams();

return (
<PostHogProvider client={posthog}>
<TooltipProvider>
<PlausibleProvider domain="dub.co" revenue />
<TooltipProvider>
<KeyboardShortcutProvider>
<Toaster className="pointer-events-auto" closeButton />
<PosthogPageview />
{children}
<DubAnalytics
apiHost="/_proxy/dub"
cookieOptions={{
domain: process.env.VERCEL === "1" ? ".dub.co" : "localhost",
}}
domainsConfig={{
refer: "refer.dub.co",
}}
/>
</KeyboardShortcutProvider>
</TooltipProvider>
</PostHogProvider>
<KeyboardShortcutProvider>
<Toaster className="pointer-events-auto" closeButton />
{children}
<DubAnalytics
apiHost="/_proxy/dub"
cookieOptions={{
domain: process.env.VERCEL === "1" ? ".dub.co" : "localhost",
}}
domainsConfig={{
refer: "refer.dub.co",
}}
/>
</KeyboardShortcutProvider>
</TooltipProvider>
);
}
1 change: 0 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
"openapi-types": "^12.1.3",
"openapi3-ts": "^4.2.1",
"openid-client": "^6.8.0",
"posthog-js": "^1.164.1",
"react": "19.1.3",
"react-colorful": "^5.6.1",
"react-dom": "19.1.3",
Expand Down
5 changes: 0 additions & 5 deletions apps/web/ui/analytics/use-analytics-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import {
REGIONS,
} from "@dub/utils";
import { useParams } from "next/navigation";
import posthog from "posthog-js";
import {
ComponentProps,
ContextType,
Expand Down Expand Up @@ -839,10 +838,6 @@ export function useAnalyticsFilters({
});
}
}
posthog.capture("ai_filters_generated", {
prompt,
filters: activeFilters,
});
setStreaming(false);
} else {
queryParams({
Expand Down
2 changes: 0 additions & 2 deletions apps/web/ui/domains/add-edit-domain-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
TextCursorInput,
} from "lucide-react";
import { motion } from "motion/react";
import posthog from "posthog-js";
import { FormEvent, useEffect, useMemo, useRef, useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { toast } from "sonner";
Expand Down Expand Up @@ -249,7 +248,6 @@ export function AddEditDomainForm({
mutatePrefix("/api/links"),
]);
const data = await res.json();
posthog.capture(props ? "domain_updated" : "domain_created", data);
toast.success(endpoint.successMessage);
onSuccess?.(data);
} else {
Expand Down
31 changes: 0 additions & 31 deletions apps/web/ui/layout/posthog-pageview.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions apps/web/ui/links/link-builder/tag-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
Tooltip,
} from "@dub/ui";
import { cn } from "@dub/utils";
import posthog from "posthog-js";
import { memo, useEffect, useMemo, useState } from "react";
import { useFormContext, useWatch } from "react-hook-form";
import { toast } from "sonner";
Expand Down Expand Up @@ -241,10 +240,6 @@ export const TagSelect = memo(() => {
setSuggestedTags((tags) =>
tags.filter(({ id }) => id !== tag.id),
);
posthog.capture("ai_suggested_tag_selected", {
tag: tag.name,
url: url,
});
}}
className="group flex items-center transition-all active:scale-95"
>
Expand Down
2 changes: 0 additions & 2 deletions apps/web/ui/links/link-builder/use-link-builder-submit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { mutatePrefix } from "@/lib/swr/mutate";
import { UpgradeRequiredToast } from "@/ui/shared/upgrade-required-toast";
import { Button, useCopyToClipboard } from "@dub/ui";
import { useRouter } from "next/navigation";
import posthog from "posthog-js";
import { useCallback } from "react";
import { useFormContext } from "react-hook-form";
import { toast } from "sonner";
Expand Down Expand Up @@ -80,7 +79,6 @@ export function useLinkBuilderSubmit({
// if updating root domain link, mutate domains as well
...(getValues("key") === "_root" ? ["/api/domains"] : []),
]);
posthog.capture(props ? "link_updated" : "link_created", data);

// copy shortlink to clipboard when adding a new link
if (!props) {
Expand Down
5 changes: 0 additions & 5 deletions apps/web/ui/links/short-link-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
} from "@dub/utils";
import { TriangleAlert } from "lucide-react";
import { useParams, usePathname } from "next/navigation";
import posthog from "posthog-js";
import {
forwardRef,
HTMLProps,
Expand Down Expand Up @@ -168,10 +167,6 @@ export const ShortLinkInput = forwardRef<HTMLInputElement, ShortLinkInputProps>(
onFinish: (_, completion) => {
setGeneratedKeys((prev) => [...prev, completion]);
mutateWorkspace();
posthog.capture("ai_key_generated", {
key: completion,
url: data.url,
});
},
});

Expand Down
6 changes: 0 additions & 6 deletions apps/web/ui/modals/add-edit-tag-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
useMediaQuery,
} from "@dub/ui";
import { capitalize, cn, pluralize } from "@dub/utils";
import posthog from "posthog-js";
import {
Dispatch,
FormEvent,
Expand Down Expand Up @@ -120,11 +119,6 @@ function AddEditTagModal({
}),
}).then(async (res) => {
if (res.status === 200 || res.status === 201) {
posthog.capture(props ? "tag_edited" : "tag_created", {
tag_id: data.id,
tag_name: data.name,
tag_color: data.color,
});
await mutatePrefix(["/api/tags", "/api/links"]);
toast.success(endpoint.successMessage);
setShowAddEditTagModal(false);
Expand Down
8 changes: 0 additions & 8 deletions apps/web/ui/modals/add-edit-utm-template.modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
useMediaQuery,
UTMBuilder,
} from "@dub/ui";
import posthog from "posthog-js";
import {
Dispatch,
SetStateAction,
Expand Down Expand Up @@ -95,13 +94,6 @@ function AddEditUtmTemplateModal({
return;
}

posthog.capture(
props ? "utm-template_edited" : "utm-template_created",
{
utmTemplateId: id,
utmTemplateName: data.name,
},
);
await mutate(`/api/utm?workspaceId=${workspaceId}`);
toast.success(endpoint.successMessage);
setShowAddEditUtmTemplateModal(false);
Expand Down
13 changes: 2 additions & 11 deletions apps/web/ui/modals/link-builder/og-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
} from "@dub/ui";
import { LoadingCircle, Magic, Unsplash } from "@dub/ui/icons";
import { resizeImage } from "@dub/utils";
import posthog from "posthog-js";
import {
Dispatch,
SetStateAction,
Expand Down Expand Up @@ -120,12 +119,8 @@ function OGModalInner({
toast.error(error.message);
}
},
onFinish: (_, completion) => {
onFinish: () => {
mutate();
posthog.capture("ai_meta_title_generated", {
title: completion,
url,
});
},
});

Expand Down Expand Up @@ -170,12 +165,8 @@ function OGModalInner({
toast.error(error.message);
}
},
onFinish: (_, completion) => {
onFinish: (_, __) => {
mutate();
posthog.capture("ai_meta_description_generated", {
description: completion,
url,
});
},
});

Expand Down
6 changes: 0 additions & 6 deletions apps/web/ui/modals/upgraded-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Button, Modal, useRouterStuff, useScrollProgress } from "@dub/ui";
import { getPlanDetails, PLANS, PRO_PLAN } from "@dub/utils";
import { usePlausible } from "next-plausible";
import { useSearchParams } from "next/navigation";
import posthog from "posthog-js";
import {
Dispatch,
SetStateAction,
Expand Down Expand Up @@ -43,11 +42,6 @@ function UpgradedModal({
const period = searchParams.get("period");
if (currentPlan && period) {
plausible(`Upgraded to ${currentPlan.name}`);
posthog.capture("plan_upgraded", {
plan: currentPlan.name,
period,
revenue: currentPlan.price[period],
});
}
}
};
Expand Down
6 changes: 0 additions & 6 deletions apps/web/ui/workspaces/create-workspace-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { cn } from "@dub/utils";
import slugify from "@sindresorhus/slugify";
import { useSession } from "next-auth/react";
import { usePlausible } from "next-plausible";
import posthog from "posthog-js";
import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { toast } from "sonner";
Expand Down Expand Up @@ -85,11 +84,6 @@ export function CreateWorkspaceForm({
const { id: workspaceId } = await res.json();
plausible("Created Workspace");
// track workspace creation event
posthog.capture("workspace_created", {
workspace_id: workspaceId,
workspace_name: data.name,
workspace_slug: data.slug,
});
await Promise.all([mutate("/api/workspaces"), update()]);
onSuccess?.(data);
} else {
Expand Down
Loading