Commit e4dbef80 authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

chore: remove Google Analytics from CSP (#6888)

* disable ga

* comment
parent e169c9d9
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
<meta <meta
http-equiv="Content-Security-Policy" http-equiv="Content-Security-Policy"
<% if (process.env.REACT_APP_CSP_ALLOW_UNSAFE_EVAL) { %> <% if (process.env.REACT_APP_CSP_ALLOW_UNSAFE_EVAL) { %>
content="script-src 'self' https://www.google-analytics.com https://www.googletagmanager.com 'unsafe-inline' 'unsafe-eval'" content="script-src 'self' 'unsafe-inline' 'unsafe-eval'"
<% } else { %> <% } else { %>
content="script-src 'self' https://www.google-analytics.com https://www.googletagmanager.com 'unsafe-inline'" content="script-src 'self' 'unsafe-inline'"
<% } %> <% } %>
/> />
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
--> -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="preconnect" href="https://www.google-analytics.com/" />
<link rel="preload" href="%PUBLIC_URL%/fonts/Inter-roman.var.woff2" as="font" type="font/woff2" crossorigin /> <link rel="preload" href="%PUBLIC_URL%/fonts/Inter-roman.var.woff2" as="font" type="font/woff2" crossorigin />
<style> <style>
......
import ReactGA from 'react-ga4' /* eslint-disable no-unused-vars */
// TODO(WEB-2166): Delete this file when we remove Google Analytics completely.
import { GaOptions, InitOptions, UaEventOptions } from 'react-ga4/types/ga4' import { GaOptions, InitOptions, UaEventOptions } from 'react-ga4/types/ga4'
/** /**
...@@ -6,7 +9,7 @@ import { GaOptions, InitOptions, UaEventOptions } from 'react-ga4/types/ga4' ...@@ -6,7 +9,7 @@ import { GaOptions, InitOptions, UaEventOptions } from 'react-ga4/types/ga4'
*/ */
export default class GoogleAnalyticsProvider { export default class GoogleAnalyticsProvider {
public sendEvent(event: string | UaEventOptions, params?: any) { public sendEvent(event: string | UaEventOptions, params?: any) {
ReactGA.event(event, params) // ReactGA.event(event, params)
} }
public initialize( public initialize(
...@@ -19,11 +22,11 @@ export default class GoogleAnalyticsProvider { ...@@ -19,11 +22,11 @@ export default class GoogleAnalyticsProvider {
gtagOptions?: any gtagOptions?: any
} }
) { ) {
ReactGA.initialize(GA_MEASUREMENT_ID, options) // ReactGA.initialize(GA_MEASUREMENT_ID, options)
} }
public set(fieldsObject: any) { public set(fieldsObject: any) {
ReactGA.set(fieldsObject) // ReactGA.set(fieldsObject)
} }
public outboundLink( public outboundLink(
...@@ -34,18 +37,18 @@ export default class GoogleAnalyticsProvider { ...@@ -34,18 +37,18 @@ export default class GoogleAnalyticsProvider {
}, },
hitCallback: () => unknown hitCallback: () => unknown
) { ) {
ReactGA.outboundLink({ label }, hitCallback) // ReactGA.outboundLink({ label }, hitCallback)
} }
public pageview(path?: string, _?: string[], title?: string) { public pageview(path?: string, _?: string[], title?: string) {
ReactGA.pageview(path, _, title) // ReactGA.pageview(path, _, title)
} }
public ga(...args: any[]) { public ga(...args: any[]) {
ReactGA.ga(...args) // ReactGA.ga(...args)
} }
public gaCommandSendTiming(timingCategory: any, timingVar: any, timingValue: any, timingLabel: any) { public gaCommandSendTiming(timingCategory: any, timingVar: any, timingValue: any, timingLabel: any) {
ReactGA._gaCommandSendTiming(timingCategory, timingVar, timingValue, timingLabel) // ReactGA._gaCommandSendTiming(timingCategory, timingVar, timingValue, timingLabel)
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment