From 891cf46a9bad12f7165bd7dd9a86de6630c7920d Mon Sep 17 00:00:00 2001 From: han Date: Fri, 30 Aug 2024 07:22:59 +0800 Subject: [PATCH] Send ga metric as int --- src/__tests__/mocks/walcron-microfrontend-shared.ts | 2 +- src/components/GoogleAnalytic/GoogleAnalytic.jest.test.tsx | 2 +- src/components/GoogleAnalytic/index.tsx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/__tests__/mocks/walcron-microfrontend-shared.ts b/src/__tests__/mocks/walcron-microfrontend-shared.ts index 2f7fe31a2..ea8c60e08 100644 --- a/src/__tests__/mocks/walcron-microfrontend-shared.ts +++ b/src/__tests__/mocks/walcron-microfrontend-shared.ts @@ -4,7 +4,7 @@ jest.mock("@yoonghan/walcron-microfrontend-shared", () => { reportWebVitals: (callback: any) => { callback({ name: "CLS", - delta: 1, + delta: 1.1, id: "test", value: 2, }) diff --git a/src/components/GoogleAnalytic/GoogleAnalytic.jest.test.tsx b/src/components/GoogleAnalytic/GoogleAnalytic.jest.test.tsx index 58eeea164..30275352e 100644 --- a/src/components/GoogleAnalytic/GoogleAnalytic.jest.test.tsx +++ b/src/components/GoogleAnalytic/GoogleAnalytic.jest.test.tsx @@ -19,7 +19,7 @@ describe("Google Analytic", () => { metric_delta: 1, metric_id: "test", metric_value: 2, - value: 1, + value: 1.1, }) rerender() diff --git a/src/components/GoogleAnalytic/index.tsx b/src/components/GoogleAnalytic/index.tsx index 25279a926..f60e56690 100644 --- a/src/components/GoogleAnalytic/index.tsx +++ b/src/components/GoogleAnalytic/index.tsx @@ -20,10 +20,10 @@ export function GoogleAnalytic({ ga4Id }: Props) { */ reportWebVitals(({ name, delta, id, value }) => { ReactGA.event(name, { - value: Math.floor(delta), + value: delta, metric_id: id, metric_value: value, - metric_delta: delta, + metric_delta: Math.floor(delta), }) }) }, [ga4Id])