File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Enable analytics during development - for debugging purposes
2+ // Analytics are always enabled in non-dev environments
3+ NEXT_PUBLIC_ENABLE_ANALYTICS = false
4+ // Enables ads during development - for debugging purposes
5+ // Ads are always enabled in non-dev environments
6+ NEXT_PUBLIC_ENABLE_ADS = false
7+
18// Google Analytics measurement ID - not required
29NEXT_PUBLIC_GA_MEASUREMENT_ID = " G-XXXXXXXXXX"
3- // Google Tag Manager ID - not required
4- NEXT_PUBLIC_GTM_ID = " GTM-XXXXXXXX"
510// Google Adsense publisher ID - not required
611NEXT_PUBLIC_ADSENSE_PUBLISHER_ID = " pub-XXXXXXXXXXXXXXXX"
712// GitHub OAuth
Original file line number Diff line number Diff line change 5252 "dependencies" : {
5353 "@codemirror/language" : " 6.0.0" ,
5454 "@growthbook/growthbook-react" : " ^1.1.0" ,
55- "@magicul/next-google-tag-manager" : " ^2.0.0" ,
5655 "@popperjs/core" : " 2.11.8" ,
5756 "@tippyjs/react" : " ^4.2.6" ,
5857 "@types/bootstrap" : " ^5.2.10" ,
Original file line number Diff line number Diff line change @@ -5,7 +5,12 @@ import { getEnvironment } from "@/scripts/Utils/Environment";
55export function Adsense ( ) : React . ReactNode {
66 React . useEffect ( ( ) => {
77 if ( getEnvironment ( ) === "development" ) {
8- console . info ( "Google Adsense disabled during development" ) ;
8+ if ( process . env . NEXT_PUBLIC_ENABLE_ADS ) {
9+ console . info ( "Enabling Google Adsense during development" ) ;
10+ } else {
11+ console . info ( "Google Adsense disabled during development" ) ;
12+ return ;
13+ }
914 }
1015 } , [ ] ) ;
1116
Original file line number Diff line number Diff line change @@ -68,14 +68,22 @@ export function Analytics(): React.ReactNode {
6868 } ) ;
6969
7070 if ( getEnvironment ( ) === "development" ) {
71- console . info ( "Google Analytics disabled during development" ) ;
72- return ;
71+ if ( process . env . NEXT_PUBLIC_ENABLE_ANALYTICS ) {
72+ console . info ( "Enabling Google Analytics during development" ) ;
73+ } else {
74+ console . info ( "Google Analytics disabled during development" ) ;
75+ return ;
76+ }
7377 }
7478
7579 setUseGA ( true ) ;
7680 } , [ ] ) ;
7781
78- return useGA ? < GoogleAnalytics trackPageViews /> : < > </ > ;
82+ return useGA ? (
83+ < GoogleAnalytics trackPageViews = { { ignoreHashChange : true } } />
84+ ) : (
85+ < > </ >
86+ ) ;
7987}
8088
8189export default Analytics ;
Original file line number Diff line number Diff line change @@ -158,13 +158,10 @@ export function ThemeProxy({
158158
159159 React . useEffect ( ( ) => {
160160 if ( loadedPreferredTheme ) {
161+ const osWantsDark = window . matchMedia ( "(prefers-color-scheme: dark)" ) ;
161162 switch ( dropdownTheme ) {
162163 case "Auto" : {
163- setActualTheme (
164- window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
165- ? "Dark"
166- : "Light" ,
167- ) ;
164+ setActualTheme ( osWantsDark ? "Dark" : "Light" ) ;
168165 break ;
169166 }
170167 default : {
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import "katex/dist/katex.min.css";
77import "tippy.js/dist/tippy.css" ;
88import Adsense from "../components/Adsense" ;
99import Analytics from "../components/Analytics" ;
10- import GoogleTagManager from "@magicul/next-google-tag-manager" ;
1110import ErrorBoundary from "../components/ErrorBoundary" ;
1211import { SessionProvider } from "next-auth/react" ;
1312import { useRouter } from "next/router" ;
@@ -115,7 +114,6 @@ export default function AwesomeArcadeExtensions({
115114 options = { { showSpinner : false } }
116115 />
117116 < Analytics />
118- < GoogleTagManager id = { process . env . NEXT_PUBLIC_GTM_ID ! } />
119117 < Adsense />
120118 < GrowthBookProvider growthbook = { growthbook } >
121119 < SessionProvider session = { session } >
Original file line number Diff line number Diff line change 11131113 dependencies :
11141114 " @lezer/common" " ^1.0.0"
11151115
1116- " @magicul/next-google-tag-manager@^2.0.0 " :
1117- version "2.0.0"
1118- resolved "https://registry.yarnpkg.com/@magicul/next-google-tag-manager/-/next-google-tag-manager-2.0.0.tgz#04a77b506a4385f84cf637267984bd6f334f5ce0"
1119- integrity sha512-NXp0iGxdcAZL9IkkWwh2GS3dE1qSn4hGxXADnvt1li4gAXyxJ9AEDTrgqMVXIDzkGTD7Q0n37BJoCZdmwIXE+g==
1120-
11211116" @monaco-editor/loader@^1.3.2 " :
11221117 version "1.4.0"
11231118 resolved "https://registry.yarnpkg.com/@monaco-editor/loader/-/loader-1.4.0.tgz#f08227057331ec890fa1e903912a5b711a2ad558"
You can’t perform that action at this time.
0 commit comments