Custom Assignments
Events with custom assignments are counted as eligible events by the ABsmartly
statistics engines. If you are using these methods for development purposes
(to force a particular variant for yourself or somebody else on the team) it is
likely that you need the
context.override
methods
instead.
- Javascript
- Python3
- React
- Swift
- Vue2
- Vue3
- Java
- Go
- .NET
- PHP
- Ruby
- Flutter/Dart
Sometimes it may be necessary to override the automatic selection of a variant.
For example, if you wish to have your variant chosen based on data from an
API call. This can be accomplished using the context.customAssignment()
method.
const chosenVariant = 1;
context.customAssignment("experiment_name", chosenVariant);
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the customAssignments
method.
const assignments = {
experiment_name: 1,
another_experiment_name: 0,
a_third_experiment_name: 2,
};
context.customAssignments(assignments);
Sometimes it may be necessary to override the automatic selection of a
variant. For example, if you wish to have your variant chosen based on
data from an API call. This can be accomplished using the
set_custom_assignment()
method.
context.set_custom_assignment("exp_test_not_eligible", 3)
If you are running multiple experiments and need to choose different
custom assignments for each one, you can do so using the
set_custom_assignments()
method.
context.set_custom_assignments({"db_user_id2": 1})
Sometimes it may be necessary to override the automatic selection of a variant.
For example, if you wish to have your variant chosen based on data from an
API call. This can be accomplished using the context.customAssignment()
method.
const chosenVariant = 1;
context.customAssignment("experiment_name", chosenVariant);
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the customAssignments
method.
const assignments = {
experiment_name: 1,
another_experiment_name: 0,
a_third_experiment_name: 2,
};
context.customAssignments(assignments);
Sometimes it may be necessary to override the automatic selection of a variant.
For example, if you wish to have your variant chosen based on data from an
API call. This can be accomplished using the context.setCustomAssignment()
method.
let chosenVariant = 1
context.setCustomAssignment("experiment_name", chosenVariant)
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the setCustomAssignments
method.
let assignments = ["experiment_name": 1,
"another_experiment_name": 0,
"a_third_experiment_name": 2]
context.setCustomAssignments(assignments)
Sometimes it may be necessary to override the automatic selection of a variant.
For example, if you wish to have your variant chosen based on data from an
API call. This can be accomplished using the customAssignment()
method.
const chosenVariant = 1;
this.$absmartly.customAssignment("experiment_name", chosenVariant);
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the customAssignments()
method.
const assignments = {
experiment_name: 1,
another_experiment_name: 0,
a_third_experiment_name: 2,
};
this.$absmartly.customAssignments(assignments);
Sometimes it may be necessary to override the automatic selection of a variant.
For example, if you wish to have your variant chosen based on data from an
API call. This can be accomplished using the customAssignment()
method.
const chosenVariant = 1;
this.$absmartly.customAssignment("experiment_name", chosenVariant);
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the customAssignments()
method.
const assignments = {
experiment_name: 1,
another_experiment_name: 0,
a_third_experiment_name: 2,
};
this.$absmartly.customAssignments(assignments);
Sometimes it may be necessary to override the automatic selection of a variant.
For example, if you wish to have your variant chosen based on data from an
API call. This can be accomplished using the setCustomAssignment()
method.
final int chosenVariant = 1;
context.setCustomAssignment("experiment_name", chosenVariant);
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the setCustomAssignments()
method.
final Map<String, Integer> assignments = Map.of(
"experiment_name", 1,
"another_experiment_name", 0,
"a_third_experiment_name", 2,
)
context.setCustomAssignments(assignments);
Sometimes it may be necessary to override the automatic selection of a variant.
For example, if you wish to have your variant chosen based on data from an
API call. This can be accomplished using the SetCustomAssignment()
method.
var chosenVariant = 1;
context.SetCustomAssignment("experiment_name", chosenVariant);
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the SetCustomAssignments()
method.
var assignments = map[string]int{
"experiment_name": 1,
"another_experiment_name": 0,
"a_third_experiment_name": 2,
}
context.SetCustomAssignments(assignments)
Sometimes it may be necessary to override the automatic selection of a variant.
For example, if you wish to have your variant chosen based on data from an
API call. This can be accomplished using the SetCustomAssignment()
method.
var chosenVariant = 1;
context.SetCustomAssignment("experiment_name", chosenVariant);
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the SetCustomAssignments()
method.
var assignments = new Dictionary<string,int>(){
{"experiment_name", 1},
{"another_experiment_name", 0},
{"a_third_experiment_name", 2}
}
context.SetCustomAssignments(assignments)
Sometimes it may be necessary to override the automatic selection of a variant.
For example, if you wish to have your variant chosen based on data from an
API call. This can be accomplished using the Context->setCustomAssignment()
method.
$chosenVariant = 1;
$context->setCustomAssignment("experiment_name", $chosenVariant);
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the
Context->setCustomAssignments()
method.
$assignments = [
"experiment_name" => 1,
"another_experiment_name" => 0,
"a_third_experiment_name" => 2
];
$context->setCustomAssignments($assignments);
Sometimes it may be necessary to override the automatic selection of a
variant. For example, if you wish to have your variant chosen based on data
from an API call. This can be accomplished using the set_custom_assignment()
method.
chosen_variant = 1
context.set_custom_assignment('experiment_name', chosen_variant)
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the set_custom_assignments()
method.
assignments = [
'experiment_name' => 1,
'another_experiment_name' => 0,
'a_third_experiment_name' => 2
]
context.set_custom_assignments(assignments)
Sometimes it may be necessary to override the automatic selection of a
variant. For example, if you wish to have your variant chosen based on data
from an API call. This can be accomplished using the setCustomAssignment()
method.
context.setCustomAssignment("experimentName", 1);
If you are running multiple experiments and need to choose different custom
assignments for each one, you can do so using the setCustomAssignments()
method.
context.setCustomAssignments({"experimentName": 1});
These methods can be called before or after the context is ready.