We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c8503bc commit f42a971Copy full SHA for f42a971
frontend/src/reportWebVitals.ts
@@ -1,5 +1,6 @@
1
import { Metric } from 'web-vitals'
2
import ReactGA from 'react-ga4'
3
+import { UaEventOptions } from 'react-ga4/types/ga4'
4
5
const getAnalyticsId = () => process.env.GOOGLE_ANALYTICS_TRACKING_ID
6
const isDev = () => process.env.NODE_ENV && process.env.NODE_ENV === 'development'
@@ -12,12 +13,13 @@ const getEventValueFromMetric = (metric: Metric) => {
12
13
}
14
15
const reportHandler = (metric: Metric) => {
- const event = {
16
+ const event: UaEventOptions = {
17
category: 'Web Vitals',
18
action: metric.name,
19
value: getEventValueFromMetric(metric),
20
label: metric.id,
- nonInteraction: true
21
+ nonInteraction: true,
22
+ transport: 'beacon'
23
24
25
if (isDev()) {
0 commit comments