Skip to content

Commit 57d146a

Browse files
Revert "add plausible server side analytics" (#2366)
Revert "add plausible server side analytics (#2308)" This reverts commit 3180988.
1 parent a702059 commit 57d146a

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/middleware.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
import metrics from "../metrics";
2-
import {APIContext} from "astro";
32

4-
export async function onRequest({ request, clientAddress }: APIContext, next: () => any) {
3+
export async function onRequest({ request }: any, next: () => any) {
54
const path = new URL(request.url).pathname.slice(1);
6-
7-
await fetch("https://plausible.io/api/event", {
8-
method: "POST",
9-
headers: {
10-
"Content-Type": "application/json",
11-
"User-Agent": request.headers.get("User-Agent")!,
12-
"X-Forwarded-For": clientAddress,
13-
},
14-
body: JSON.stringify({
15-
domain: "sprig.hackclub.com",
16-
url: request.url,
17-
name: "pageview"
18-
})
19-
})
20-
5+
216
if (!path.includes("api")) return next();
227

238
const metricName = path.split("/").join("_");

0 commit comments

Comments
 (0)