Problem
When using SDK, 'control' treatment is either always or very often returned from getTreatment call
Root Cause
When getTreatment call return 'control', this means either:
- The there is an issue with network connection to Split cloud and http calls are timing out.
- Or the SDK is still downloading relevant Split definitions and Segments from Split cloud and still did not finish when getTreatment call is executed.
Solution
The 'control' treatment are most likely to return using the mobile SDKs; Javascript, Android and iOS. Simply because potentially the SDK runs on user's mobile devices which has slow network connection.
That is why for these SDKs getTreatment should always be called when the SDK_READY events fires, which will ensure its called after the SDK downloads all the information from Split cloud and avoid returning 'control' treatments.
client.on(client.Event.SDK_READY, function() {
var treatment = client.getTreatment("SPLIT_NAME");
if (treatment == "on") {
// insert code here to show on treatment
} else if (treatment == "off") {
// insert code here to show off treatment
} else {
// insert your control treatment code here
}
});
Comments
0 comments
Please sign in to leave a comment.