<html>
<head>
<title>Split SDK Quickstart Example</title>
</head>
<body>
<h1>Split SDK Quickstart Example</h1>
<p>Open the console and input <code>localStorage.splitio_debug = 'on'</code> then refresh to see some logs.</p> <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
<script src="https://cdn.split.io/sdk/split-10.22.4.js"></script> <script type="text/javascript">
(function() {
var factory = splitio({
core: {
authorizationKey: 'YOUR_SDK_KEY',
key: 'CUSTOMER_ID'
}
});
var client = factory.client(); client.on(client.Event.SDK_READY, () => {
console && console.log('Split SDK is ready to evaluate.');
var treatment = client.getTreatment('FEATURE_FLAG_NAME');
console && console.log('Treatment is: ' + treatment); if (treatment === 'on') {
console.log("I'm ON");
} else if (treatment === 'off') {
console.log("I'm OFF");
} else {
console.log("CONTROL was returned, there was an error");
} client.destroy().then(function() {
console && console.log('Split SDK data was successfully flushed.');
});
});
})();
</script>
</body>
</html>
<html>
(function() {
var factory = splitio({
core: {
authorizationKey: 'YOUR_SDK_KEY',
key: 'CUSTOMER_ID'
}
});
var client = factory.client(); client.on(client.Event.SDK_READY, () => {
console && console.log('Split SDK is ready to evaluate.');
var treatment = client.getTreatment('FEATURE_FLAG_NAME');
console && console.log('Treatment is: ' + treatment); if (treatment === 'on') {
console.log("I'm ON");
} else if (treatment === 'off') {
console.log("I'm OFF");
} else {
console.log("CONTROL was returned, there was an error");
} client.destroy().then(function() {
console && console.log('Split SDK data was successfully flushed.');
});
});
})();