Skip to content

Commit ac4fb85

Browse files
committed
Use Posthog over Vercel analytics
1 parent e971d98 commit ac4fb85

File tree

7 files changed

+113
-86
lines changed

7 files changed

+113
-86
lines changed

frontend/next.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ const nextConfig = {
8989
source: "/graphql",
9090
destination: `${API_URL_SERVER}/graphql`,
9191
},
92+
{
93+
source: "/ingest/static/:path*",
94+
destination: "https://eu-assets.i.posthog.com/static/:path*",
95+
},
96+
{
97+
source: "/ingest/:path*",
98+
destination: "https://eu.i.posthog.com/:path*",
99+
},
92100
];
93101

94102
if (API_URL_SERVER.includes("http://backend")) {

frontend/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
"@neshca/cache-handler": "^1.9.0",
2727
"@python-italia/pycon-styleguide": "0.1.210",
2828
"@sentry/nextjs": "^8.45.0",
29-
"@vercel/analytics": "^1.1.1",
3029
"@vercel/og": "^0.6.5",
31-
"@vercel/speed-insights": "^1.0.12",
3230
"@xstate/react": "^3.0.1",
3331
"clsx": "^1.2.1",
3432
"concurrently": "^9.1.0",
@@ -45,6 +43,7 @@
4543
"next": "15.2.0",
4644
"next-cookies": "^2.0.3",
4745
"pdfkit": "^0.15.1",
46+
"posthog-js": "^1.225.0",
4847
"react": "19.0.0",
4948
"react-dnd": "^11.1.3",
5049
"react-dnd-html5-backend": "^11.1.3",

frontend/pnpm-lock.yaml

Lines changed: 50 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/add-schedule-to-calendar-modal/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Spacer,
66
Text,
77
} from "@python-italia/pycon-styleguide";
8-
import va from "@vercel/analytics";
8+
import posthog from "posthog-js";
99
import { FormattedMessage } from "react-intl";
1010
import { useCurrentUser } from "~/helpers/use-current-user";
1111
import { useTranslatedMessage } from "~/helpers/use-translated-message";
@@ -38,7 +38,7 @@ export const AddScheduleToCalendarModal = ({ onClose }: Props) => {
3838
const autoSelectInput = (e: React.MouseEvent<HTMLInputElement>) => {
3939
(e.target as HTMLInputElement).select();
4040
document.execCommand("copy");
41-
va.track("copy-calendar-url");
41+
posthog.capture("copy-calendar-url");
4242
};
4343

4444
const pleaseWaitMessage = useTranslatedMessage("login.loading");

frontend/src/components/schedule-view/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
Spacer,
77
Text,
88
} from "@python-italia/pycon-styleguide";
9-
import va from "@vercel/analytics";
9+
import posthog from "posthog-js";
10+
1011
import { isAfter, isBefore, parseISO } from "date-fns";
1112
import { fromZonedTime } from "date-fns-tz";
1213
import React, {
@@ -144,7 +145,7 @@ export const ScheduleView = ({
144145
setViewMode((current) => {
145146
const nextValue = current === "grid" ? "list" : "grid";
146147
prevViewMode.current = nextValue;
147-
va.track("schedule-view", { view: nextValue });
148+
posthog.capture("schedule-view", { view: nextValue });
148149
return nextValue;
149150
});
150151
}, []);

frontend/src/middleware.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export async function middleware(req: NextRequest) {
3131
!PUBLIC_FILE.test(req.nextUrl.pathname) &&
3232
!req.nextUrl.pathname.includes("/api/") &&
3333
!req.nextUrl.pathname.includes("/admin") &&
34+
!req.nextUrl.pathname.includes("/ingest") &&
3435
!req.nextUrl.pathname.includes("/local_files_upload") &&
3536
!req.nextUrl.pathname.includes("/media") &&
3637
!req.nextUrl.pathname.includes("/graphql") &&

0 commit comments

Comments
 (0)