From 4919f028c884a041da7ff098abb02389b4eac598 Mon Sep 17 00:00:00 2001
From: 简律纯 <hsiangnianian@outlook.com>
Date: Tue, 18 Apr 2023 03:02:17 +0800
Subject: ✨add envshare docs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 envshare/app/components/analytics.tsx | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 envshare/app/components/analytics.tsx

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

diff --git a/envshare/app/components/analytics.tsx b/envshare/app/components/analytics.tsx
new file mode 100644
index 0000000..ef6a2ae
--- /dev/null
+++ b/envshare/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

