Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Rename stats to analytics

Steven Tey5706e19dd746
diff --git a/apps/web/app/api/stats/[endpoint]/route.ts b/apps/web/app/api/analytics/[endpoint]/route.ts
similarity index 92%
rename from apps/web/app/api/stats/[endpoint]/route.ts
rename to apps/web/app/api/analytics/[endpoint]/route.ts
index 901a327137..9d796fe286 100644
--- a/apps/web/app/api/stats/[endpoint]/route.ts
+++ b/apps/web/app/api/analytics/[endpoint]/route.ts
@@ -2,7 +2,7 @@ import { withAuth } from "@/lib/auth";
import { getStats } from "@/lib/stats";
import { NextResponse } from "next/server";
-// GET /api/stats/[endpoint] – get stats for a specific endpoint
+// GET /api/analytics/[endpoint] – get stats for a specific endpoint
export const GET = withAuth(
async ({ params, searchParams, project }) => {
const { endpoint } = params;
diff --git a/apps/web/app/api/edge/stats/[endpoint]/route.ts b/apps/web/app/api/analytics/edge/[endpoint]/route.ts
similarity index 100%
rename from apps/web/app/api/edge/stats/[endpoint]/route.ts
rename to apps/web/app/api/analytics/edge/[endpoint]/route.ts
diff --git a/apps/web/app/api/stats/route.ts b/apps/web/app/api/analytics/route.ts
similarity index 100%
rename from apps/web/app/api/stats/route.ts
rename to apps/web/app/api/analytics/route.ts
diff --git a/apps/web/app/api/projects/[slug]/stats/[endpoint]/route.ts b/apps/web/app/api/projects/[slug]/stats/[endpoint]/route.ts
index 33265a2e2a..e49d9e17af 100644
--- a/apps/web/app/api/projects/[slug]/stats/[endpoint]/route.ts
+++ b/apps/web/app/api/projects/[slug]/stats/[endpoint]/route.ts
@@ -1 +1 @@
-export * from "../../../../stats/[endpoint]/route";
+export * from "../../../../analytics/[endpoint]/route";
diff --git a/apps/web/app/api/projects/[slug]/stats/route.ts b/apps/web/app/api/projects/[slug]/stats/route.ts
index 453e76454c..bbf49fabdf 100644
--- a/apps/web/app/api/projects/[slug]/stats/route.ts
+++ b/apps/web/app/api/projects/[slug]/stats/route.ts
@@ -1 +1 @@
-export * from "../../../stats/route";
+export * from "../../../analytics/route";
diff --git a/apps/web/ui/domains/domain-card.tsx b/apps/web/ui/domains/domain-card.tsx
index 187bcd2161..a358ba0ef4 100644
--- a/apps/web/ui/domains/domain-card.tsx
+++ b/apps/web/ui/domains/domain-card.tsx
@@ -44,7 +44,7 @@ export default function DomainCard({ props }: { props: DomainProps }) {
);
const { data: clicks } = useSWR<number>(
- slug && `/api/projects/${slug}/stats/clicks?domain=${domain}&key=_root`,
+ slug && `/api/projects/${slug}/analytics/clicks?domain=${domain}&key=_root`,
fetcher,
{
fallbackData: props.clicks,
diff --git a/apps/web/ui/stats/index.tsx b/apps/web/ui/stats/index.tsx
index 34238d30ee..5e2b55879e 100644
--- a/apps/web/ui/stats/index.tsx
+++ b/apps/web/ui/stats/index.tsx
@@ -85,7 +85,7 @@ export default function Stats({
// Public stats page, e.g. dub.co/stats/github, stey.me/stats/weathergpt
return {
basePath: `/stats/${key}`,
- baseApiPath: `/api/edge/stats`,
+ baseApiPath: `/api/analytics/edge`,
domain: staticDomain,
};
}, [slug, pathname, staticDomain, domainSlug, key]);