Gate analytics and cache public API requests

This commit is contained in:
2569718930@qq.com
2026-04-06 13:58:11 +08:00
parent 9be12ad1d7
commit 08d7308486
14 changed files with 114 additions and 309 deletions
+4 -1
View File
@@ -1,5 +1,8 @@
"use client";
const ANALYTICS_ENABLED =
process.env.NEXT_PUBLIC_POLYWEATHER_APP_ANALYTICS === "true";
type TrackableAnalyticsEvent =
| "signup_completed"
| "dashboard_active"
@@ -68,7 +71,7 @@ export function trackAppEvent(
eventType: TrackableAnalyticsEvent,
payload: Record<string, unknown> = {},
) {
if (!isClient()) return;
if (!isClient() || !ANALYTICS_ENABLED) return;
const body = {
event_type: eventType,
client_id: getAnalyticsClientId() || undefined,