Tracking Goals
Use the track()
method to record any actions that your customers perform.
Each action is known as a goal and corresponds to a goal_name
as defined in
the Web Console. Calling track()
through the SDKs is the easiest way of
getting experimentation data into ABsmartly and allows you to measure the
impact of your experiments on your users' actions and metrics. You can also
track goals through the Segment.io integration or by using enrichments to
consume them from other event streams and/or databases. In the examples below
you can see that the track()
method can take up to two arguments. The proper
data type and syntax for each are:
- goal_name: The traffic type of the key in the
track()
call. The expected data type isString
. You should only pass values that match the names of goals that you have defined in the Web Console, everything else will be ignored. - properties (Optional): An object of key value pairs that can be used to create extra metrics or to filter the goal.
- Javascript
- Python3
- React
- Swift
- Vue2
- Vue3
- Java
- Go
- .NET
- PHP
- Ruby
- Flutter/Dart
var properties = {
price: 10000,
category: "5 stars",
free_cancellation: true,
instance_id: 5350,
};
context.track("booking", properties);
context.track("payment", {
"item_count": 1,
"total_amount": 1999.99
})
const properties = {
price: 10000,
category: "5 stars",
free_cancellation: true,
instance_id: 5350,
};
context.track("booking", properties);
context.track("payment", properties: ["item_count": 1, "total_amount": 1999.99])
var properties = {
price: 10000,
category: "5 stars",
free_cancellation: true,
instance_id: 5350,
};
this.$absmartly.track("booking", properties);
var properties = {
price: 10000,
category: "5 stars",
free_cancellation: true,
instance_id: 5350,
};
this.$absmartly.track("booking", properties);
context.track("payment", Map.of(
"item_count", 1,
"total_amount", 1999.99
));
context.Track("payment", map[string]interface{}{
"item_count": 1,
"total_amount": 1999.99
})
context.Track("payment", new Dictionary<string, object>() {
{ "item_count", 1 },
{ "total_amount", 1999.99}
});
$context->track(
'payment',
(object) ['item_count' => 1, 'total_amount' => 1999.99]
);
context.track(
'payment',
{ item_count: 1, total_amount: 1999.99 }
)
context.track("payment",{
"item_count": 1,
"total_amount": 1999.99
});