File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ app.use(
6868 '*.google-analytics.com' ,
6969 '*.cloudfunctions.net' ,
7070 'sentry.io' ,
71+ '*.sentry.io' ,
72+ 'https://plausible.io' ,
7173 ...wsUrls ,
7274 ] ,
7375 defaultSrc : [
@@ -88,6 +90,7 @@ app.use(
8890 '*.analytics.google.com' ,
8991 '*.google-analytics.com' ,
9092 'www.youtube.com' ,
93+ 'https://plausible.io' ,
9194 "'unsafe-eval'" ,
9295 "'unsafe-inline'" ,
9396 ] ,
Original file line number Diff line number Diff line change @@ -3,9 +3,16 @@ import ReactGA from 'react-ga4'
33import { useLocation } from '@remix-run/react'
44import { GA_TRACKING_ID } from 'src/config/config'
55
6+ declare global {
7+ interface Window {
8+ plausible ?: ( event : string , options ?: Record < string , any > ) => void
9+ }
10+ }
11+
612export const GoogleAnalytics = ( ) => {
713 const location = useLocation ( )
814
15+ // TODO: remove GA
916 useEffect ( ( ) => {
1017 if ( GA_TRACKING_ID ) {
1118 ReactGA . initialize ( [ { trackingId : GA_TRACKING_ID } ] )
@@ -18,6 +25,12 @@ export const GoogleAnalytics = () => {
1825 }
1926 } , [ location ] )
2027
28+ useEffect ( ( ) => {
29+ if ( window . plausible ) {
30+ window . plausible ( 'pageview' )
31+ }
32+ } , [ location . pathname , location . search ] )
33+
2134 const sendPageView = ( location : any ) => {
2235 ReactGA . set ( { page : location . pathname } )
2336 ReactGA . send ( { hitType : 'pageview' , page : location . pathname } )
You can’t perform that action at this time.
0 commit comments