Traffic Distribution

When conducting an A/B test, not only do you need to distribute your users to different test groups, but you also need to write a logic for each test group. After the SDK integration stage, the Hackle SDK will distribute users into different test groups.


Test Groups

The test groups are basically the different groups that are exposed to the versions (features, screens, algorithms, etc) of a page of an experiment. Test groups include both the control test group A and treatment test groups B, C, D, etc., that are exposed to the "improved" versions of the pages.
The test groups can be set on the dashboard and further information on the test groups can be found on the What is a Test Group? document.


Unity Editor

Unity SDK relies on Android and iOS SDKs.
Hence, A/B tests conducted on Unity Editor will return all users to test group A.


By passing the experiment key to the variation() method, the SDK will distribute users and you will receive the results of the distribution for the specific experiment. After that, we implement the logic of the page version applicable for each test group.

In the example code below, we are passing an experiment key of 42, and there are two test groups, A and B.

// Determines the test group to assign in an A/B tests with an experiment key of 42.
// For undetermined cases, the user is returned to test group A.
string variation = hackle.Variation(42);

// Logic for the different test groups
if (variation == "A") {
  // Logic for test group A
} else if (variation == "B") {
  // Logic for test group B


The variation_detail() method works the same as the variation() method but provides the reason for a user being distributed to a specific group. This method can be a useful tool to see if the distribution is working properly.
You must pass the experiment key as a parameter. For the example code below, we are passing experimental key 42.

// Traffic distribution details 
HackleDecision decision = hackle.VariationDetail(42);

// Test group determined from distribution
string variation = decision.variation;

// Reason for distribution to a test group
string reason = decision.reason;

You will receive the reason for the distribution or the allocation of a specific user to a specific test group in the form of SDK_NOT_READY. Please refer to the table below for the full list of different distribution reasons.



Distribution Result


The SDK is not ready to use.
(e.g. initialized with the wrong SDK key)

(control) Test Group A


No A/B tests were found for the experimental key you passed.
The experiment key may be incorrect or the experiment may be in the archive status.

(control) Test Group A


The A/B test is ready to start.

(control) Test Group A


The A/B test has been paused.

(control) Test Group A


A/B test has ended.

Final winning test group from the experiment


Users are distributed to a specific test group by manual assignment.

Manually assigned test group


User does not qualify as the target user for the A/B test.

(control) Test Group A


The user is qualified as a target user of the A/B test but is not included as a part of the traffic.

(control) Test Group A


User has been assigned to A/B test.

Assigned test group


The test group was removed from the A/B test.

(control) Test Group A


An unknown error has occurred.

(control) Test Group A

Did this page help you?