File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ UI := ./web
33TARGET := ./target
44LISTEN_ADDR := 0.0.0.0:8000
55DEBUG ?= true
6+ GTAG ?= # Set GTAG to enable Google Analytics
67
78.PHONY :all
89all : build
1617
1718.PHONY :ui
1819ui :
19- @cd $(UI ) && REACT_APP_LANG_SERVER=http://$(LISTEN_ADDR ) REACT_APP_VERSION=testing yarn start
20+ @cd $(UI ) && REACT_APP_LANG_SERVER=http://$(LISTEN_ADDR ) REACT_APP_GTAG= $( GTAG ) REACT_APP_VERSION=testing yarn start
2021
Original file line number Diff line number Diff line change 55 < link rel ="icon " href ="%PUBLIC_URL%/favicon.ico " />
66 < meta name ="viewport " content ="width=device-width, initial-scale=1 " />
77 < meta name ="theme-color " content ="#000000 " />
8+ < meta name ="x-gtag " content ="%REACT_APP_GTAG% " />
89 < meta
910 name ="description "
1011 content ="Better Go Playground with syntax highlight support "
2930 < body >
3031 < noscript > You need to enable JavaScript to run this app.</ noscript >
3132 < div id ="root "> </ div >
33+ < script >
34+ ( function ( d ) {
35+ var e = d . querySelector ( 'meta[name=x-gtag]' ) ;
36+ if ( ! e || ! e . content ) return ;
37+ var s = d . createElement ( 'script' ) ;
38+ s . async = true ; s . src = "https://www.googletagmanager.com/gtag/js?id=" + e . content ;
39+ s . onload = function ( ) {
40+ console . log ( 'GA load done' ) ;
41+ window . dataLayer = window . dataLayer || [ ] ;
42+ function gtag ( ) { dataLayer . push ( arguments ) ; }
43+ gtag ( 'js' , new Date ( ) ) ;
44+
45+ gtag ( 'config' , 'UA-164070125-1' ) ;
46+ } ;
47+ d . body . appendChild ( s ) ;
48+ } ) ( document )
49+ </ script >
3250 </ body >
3351</ html >
You can’t perform that action at this time.
0 commit comments