"use client"; import { Analytics } from "@vercel/analytics/next"; import { SpeedInsights } from "@vercel/speed-insights/next"; export function ConditionalAnalytics() { return ( <> { // check if user has consented const analyticsEnabled = localStorage.getItem("analytics-enabled") === "true"; // if not consented, return null to block the event if (!analyticsEnabled) { return null; } // if consented, return the event to send it return event; }} /> { // check if user has consented const analyticsEnabled = localStorage.getItem("analytics-enabled") === "true"; // if not consented, return null to block the event if (!analyticsEnabled) { return null; } // if consented, return the event to send it return event; }} /> ); }