From 50d727d0717744797b12878fa8dcbcb63fc6cf0f Mon Sep 17 00:00:00 2001 From: Elias Date: Sat, 21 Sep 2024 16:42:12 +0200 Subject: [PATCH] added Analytics --- .../components/Landingpage/DataInsights.tsx | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/app/components/Landingpage/DataInsights.tsx b/src/app/components/Landingpage/DataInsights.tsx index 733e6aa..dc64816 100644 --- a/src/app/components/Landingpage/DataInsights.tsx +++ b/src/app/components/Landingpage/DataInsights.tsx @@ -16,6 +16,7 @@ import { Legend, } from "recharts"; import { FaChartLine, FaShoppingCart } from "react-icons/fa"; +import { track } from '@vercel/analytics'; interface DataPoint { date: string; @@ -283,6 +284,8 @@ const DataInsights: React.FC = () => { setSelectedYears([]); // Clear selected years when switching to Total View setInRowView(false); // Disable In-Row View when switching } + // Track view mode change + track('View Mode Changed', { mode }); }; // Function to toggle year selection @@ -295,6 +298,8 @@ const DataInsights: React.FC = () => { return [...prev, year]; } }); + // Track year selection + track('Year Selected', { year }); }; // Function to extract unique years from the data @@ -512,8 +517,12 @@ const DataInsights: React.FC = () => { {/* Toggle Button for Total In-Row View */}