Last active
February 2, 2022 01:29
-
-
Save wschenkel/a0de20bb2903091e087604e743ef635d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [optimizeExperiment, setOptimizeExperiment] = useState(0) | |
// Id do nosso experimento | |
const experimentId = '8sFX02ltRXWrQb05dONuzA' | |
useEffect(() => { | |
const loadingOptimizer = setInterval(() => { | |
const { google_optimize } = window | |
if (google_optimize && parseInt(google_optimize?.get(experimentId)) > 0) { | |
setOptimizeExperiment(experimentId) | |
clearInterval(loadingOptimizer) | |
} | |
}, 750) | |
return () => { | |
clearInterval(loadingOptimizer) | |
} | |
}, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment