From cc22f23d9701f0256b9d06c20549d8220ef14645 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Mon, 7 Nov 2022 15:16:47 +0800 Subject: [PATCH] [portal][fix] fix incorrect page_view events --- apps/portal/src/components/global/GoogleAnalytics.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/portal/src/components/global/GoogleAnalytics.tsx b/apps/portal/src/components/global/GoogleAnalytics.tsx index 1d7d4f75..f0fe9efb 100644 --- a/apps/portal/src/components/global/GoogleAnalytics.tsx +++ b/apps/portal/src/components/global/GoogleAnalytics.tsx @@ -17,13 +17,11 @@ function pageview(measurementID: string, url: string) { return; } - window.gtag('config', measurementID, { + window.gtag('event', 'page_view', { + page_location: window.location.href, page_path: url, - }); - - window.gtag('event', url, { - event_category: 'pageview', - event_label: document.title, + page_title: document.title, + send_to: measurementID, }); }