neuralsplit
v1.2.0
Published
Automate your content split testing to drive conversions so you can focus on your product.
Readme
NeuralSplit
Automate your content split testing to drive conversions so you can focus on your product.
Installation
npm i neuralsplitOr with yarn:
yarn add neuralsplitUsage
First grab your element IDs from app.neuralsplit.com
import { getVariants, trackConversion } from 'neuralsplit';
async function App() {
const { sessionId, elements } = await getVariants({
// Get our session ID from cookies, localstorage, or wherever
sessionId: getSessionId(),
// If no session ID is provided one will be generated.
// You should provide a mechanism to save it for next time.
// Saving the session ID will result in the same variants being shown between refreshes
setSessionId,
elements: {
headline: {
id: HEADLINE_ID,
fallback: 'Welcome to my website',
},
ctaColor: {
id: CTA_COLOR_ID,
fallback: '#00aaff',
},
},
});
const handleSignupClick = async () => {
await trackConversion({
sessionId, // Variants displayed during this session are rewarded
reward: 1,
});
}
return (
<>
<h1>{elements.headline}</h1>
<button
style={{ backgroundColor: elements.ctaColor }}
onClick={handleSignupClick}
>
Sign up now
</button>
</>
)
}