File tree Expand file tree Collapse file tree 3 files changed +12
-22
lines changed Expand file tree Collapse file tree 3 files changed +12
-22
lines changed Original file line number Diff line number Diff line change 23
23
"date-fns" : " 2.29.2" ,
24
24
"diff" : " ^5.0.0" ,
25
25
"formik" : " ^2.2.9" ,
26
- "ga-gtag" : " ^1.1.7" ,
27
26
"intl-messageformat" : " ^9.8.1" ,
28
27
"notistack" : " ^2.0.4" ,
29
28
"prism-react-renderer" : " 1.2.1" ,
36
35
"react-dom" : " ^17.0.2" ,
37
36
"react-draggable" : " ^4.4.3" ,
38
37
"react-google-recaptcha-v3" : " 1.9.5" ,
38
+ "react-gtm-module" : " ^2.0.11" ,
39
39
"react-helmet" : " ^6.1.0" ,
40
40
"react-list" : " ^0.8.16" ,
41
41
"react-markdown" : " ^8.0.4" ,
Original file line number Diff line number Diff line change 1
1
import { useEffect } from 'react' ;
2
- import { useSelector } from 'react-redux' ;
3
- import { gtag , install } from 'ga-gtag' ;
2
+ import TagManager from 'react-gtm-module' ;
4
3
5
4
import { useConfig } from 'tg.globalContext/helpers' ;
6
- import { AppState } from 'tg.store/index' ;
7
-
8
- export const initGtag = ( tagId : string ) => {
9
- install ( tagId ) ;
10
- gtag ( 'js' , new Date ( ) ) ;
11
- gtag ( 'config' , tagId ) ;
12
- } ;
13
5
14
6
export const Ga4Tag = ( ) => {
15
7
const config = useConfig ( ) ;
16
8
const tag = config ?. ga4Tag ;
17
9
18
- const allowPrivate = useSelector (
19
- ( state : AppState ) => state . global . security . allowPrivate
20
- ) ;
21
-
22
10
useEffect ( ( ) => {
23
- if ( tag && allowPrivate ) {
24
- initGtag ( tag ! ) ;
11
+ if ( tag ) {
12
+ TagManager . initialize ( {
13
+ gtmId : tag ,
14
+ } ) ;
25
15
}
26
- } , [ tag , allowPrivate ] ) ;
16
+ } , [ tag ] ) ;
27
17
28
18
return null ;
29
19
} ;
You can’t perform that action at this time.
0 commit comments