From b135aac8531c1e1488147ad8c6f98eddbdbe0c99 Mon Sep 17 00:00:00 2001
From: HsiangNianian <admin@jyunko.cn>
Date: Mon, 17 Apr 2023 18:53:55 +0000
Subject: Initial commit

Created from https://vercel.com/new
---
 app/components/analytics.tsx | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 app/components/analytics.tsx

(limited to 'app/components/analytics.tsx')

diff --git a/app/components/analytics.tsx b/app/components/analytics.tsx
new file mode 100644
index 0000000..ef6a2ae
--- /dev/null
+++ b/app/components/analytics.tsx
@@ -0,0 +1,22 @@
+"use client";
+import { Analytics as VercelAnalytics } from "@vercel/analytics/react";
+
+const track = ["/", "/share", "/deploy", "/unseal"];
+
+export function Analytics() {
+  return (
+    <VercelAnalytics
+      beforeSend={(event) => {
+        const url = new URL(event.url);
+        if (!track.includes(url.pathname)) {
+          url.pathname = "/__redacted";
+          return {
+            ...event,
+            url: url.href,
+          };
+        }
+        return event;
+      }}
+    />
+  );
+}
-- 
cgit v1.2.3-70-g09d2

