File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,19 +6,20 @@ export function Adsense(): React.ReactNode {
66 const [ useGA , setUseGA ] = React . useState < boolean > ( false ) ;
77
88 React . useEffect ( ( ) => {
9+ if (
10+ process . env . NEXT_PUBLIC_ADSENSE_PUBLISHER_ID === "pub-XXXXXXXXXXXXXXXX" ||
11+ ! process . env . NEXT_PUBLIC_ADSENSE_PUBLISHER_ID
12+ ) {
13+ // console.info("No publisher ID provided, disabling Google Adsense");
14+ return ;
15+ }
916 if ( getEnvironment ( ) === "development" ) {
1017 if ( process . env . NEXT_PUBLIC_ENABLE_ADS ) {
1118 console . info ( "Enabling Google Adsense during development" ) ;
1219 } else {
1320 console . info ( "Google Adsense disabled during development" ) ;
1421 return ;
1522 }
16- } else if (
17- process . env . NEXT_PUBLIC_ADSENSE_PUBLISHER_ID === "pub-XXXXXXXXXXXXXXXX" ||
18- ! process . env . NEXT_PUBLIC_ADSENSE_PUBLISHER_ID
19- ) {
20- // console.info("No publisher ID provided, disabling Google Adsense");
21- return ;
2223 }
2324
2425 setUseGA ( true ) ;
Original file line number Diff line number Diff line change @@ -67,19 +67,20 @@ export function Analytics(): React.ReactNode {
6767 analytics_storage : getAnalyticsStorageConsent ( ) ,
6868 } ) ;
6969
70+ if (
71+ process . env . NEXT_PUBLIC_GA_MEASUREMENT_ID === "G-XXXXXXXXXX" ||
72+ ! process . env . NEXT_PUBLIC_GA_MEASUREMENT_ID
73+ ) {
74+ console . info ( "No measurement ID provided, disabling Google Analytics" ) ;
75+ return ;
76+ }
7077 if ( getEnvironment ( ) === "development" ) {
7178 if ( process . env . NEXT_PUBLIC_ENABLE_ANALYTICS ) {
7279 console . info ( "Enabling Google Analytics during development" ) ;
7380 } else {
7481 console . info ( "Google Analytics disabled during development" ) ;
7582 return ;
7683 }
77- } else if (
78- process . env . NEXT_PUBLIC_GA_MEASUREMENT_ID === "G-XXXXXXXXXX" ||
79- ! process . env . NEXT_PUBLIC_GA_MEASUREMENT_ID
80- ) {
81- console . info ( "No measurement ID provided, disabling Google Analytics" ) ;
82- return ;
8384 }
8485
8586 setUseGA ( true ) ;
You can’t perform that action at this time.
0 commit comments