0.2.0 • Published 4 years ago
opt-use-ab-hook v0.2.0
Google Optimize Use AB React Hook
Usage
The following code goes to the variant into Google Optimize
var myABTest = new CustomEvent('ab_myabtest');
window.dispatchEvent(myABTest);
The following code is inside your component
const Component = () => {
const ab = useAB('myabtest');
return (ab ? <div>yes</div> : <div>no</div>);
};
License
MIT
Author
Matheus Freire Rabelo