File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,14 @@ import "../../styles/fonts.css";
88function NavigationReact ( props ) {
99 const { currentURL } = props ;
1010 const [ isHamburgerMenuOpen , setIsHamburgerMenuOpen ] = useState ( false ) ;
11- const [ abTestVariant , setAbTestVariant ] = useState ( "main" ) ;
11+ const [ abTestVariant , setAbTestVariant ] = useState ( "main" ) ; // Default to main
1212
13+ // Use the data attribute from the body element
1314 useEffect ( ( ) => {
14- const variant = process . env . NETLIFY_BRANCH || "main" ;
15+ const variant = document . body . getAttribute ( 'data-branch' ) || "main" ;
1516 setAbTestVariant ( variant ) ;
16-
17- console . log ( process . env . NETLIFY_BRANCH ) ;
18- console . log ( `Current AB test variant: ${ variant } ` ) ;
17+
18+ console . log ( `AB test variant from body attribute: ${ variant } ` ) ;
1919 } , [ ] ) ;
2020
2121 console . log ( abTestVariant ) ;
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ const {
2020} = Astro .props ;
2121
2222const isPostDownloadPage = Astro .request .url .includes (" /post-download" );
23-
2423---
2524
2625<!doctype html >
@@ -44,15 +43,15 @@ const isPostDownloadPage = Astro.request.url.includes("/post-download");
4443 <script src =" ../assets/js/matomoTracking.js" ></script >
4544 </head >
4645 <main class =" flex flex-col h-screen" >
47- <body >
46+ <body data-branch = { import . meta . env . NETLIFY_CONTEXT || process . env . CONTEXT || ' main ' } >
4847 <a class =" skip-to-content" href =" #main" aria-label =" Skip to content"
4948 >Skip to content</a
5049 >
5150 <header class =" z-50 sticky left-0 right-0 top-0" >
5251 <NavigationReact client:load currentURL ={ Astro .request .url } />
53- <BetaBanner client:load url ={ Astro .request .url } />
54- <SurveyBanner client:load url ={ Astro .request .url } />
55- { ! isPostDownloadPage && <PromoBanner client :load /> }
52+ <BetaBanner client:load url ={ Astro .request .url } />
53+ <SurveyBanner client:load url ={ Astro .request .url } />
54+ { ! isPostDownloadPage && <PromoBanner client :load /> }
5655 </header >
5756
5857 <div class =" flex-1" >
You can’t perform that action at this time.
0 commit comments