Variant tracking
2 min
For the variant value, you should use the product variant’s SKU. Alternatively, you can supply attributes of the variant. The colour and size attributes are accepted by default. However, by arrangement with Optimizely, they can be replaced with other variant attributes.
Note If both SKU and attributes are specified, the system only uses SKU.
Example using the product variants’ SKUs.
{
"type" : "basket",
"ip" : "10.42.37.139",
"session" : "123456789012|a1b2c3d4e5A6B7C8D9E0f1g2h3i4j5F1G2H3I4J5k1l",
"cuid" : "09876543210|Z0Y9X8W7V6z5y4x3w2v1U0T9S8R7Q6u5t4s3r2q1P0O",
"site" : "retailer",
"clientToken" : "1234abcd5678",
"channel" : "web",
"lang" : "en-gb",
"currentURI" : "www.retailer.com/basket.html",
"previousURI" : "www.retailer.com/product/RC123.html",
"userAgent" : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
"basket" : {
"items" : [
{
"refCode" : "RC123",
"qty" : 5,
"price" : 50.5,
"variant" : { "sku" : "sku123" }
},
{
"refCode" : "RC124",
"qty" : 8,
"price" : 52.5,
"variant" : { "sku" : "sku124" }
}
],
"currency" : "GBP"
}
}Example using the product variant’s color and size.
{
"type" : "basket",
"ip" : "10.42.37.139",
"session" : "123456789012|a1b2c3d4e5A6B7C8D9E0f1g2h3i4j5F1G2H3I4J5k1l",
"cuid" : "09876543210|Z0Y9X8W7V6z5y4x3w2v1U0T9S8R7Q6u5t4s3r2q1P0O",
"site" : "retailer",
"clientToken" : "1234abcd5678",
"channel" : "web",
"lang" : "en-gb",
"currentURI" : "www.retailer.com/basket.html",
"previousURI" : "www.retailer.com/product/RC123.html",
"userAgent" : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
"basket" : {
"items" : [
{
"refCode" : "RC123",
"qty" : 5,
"price" : 50.5,
"variant" : {
"attributes" : {
"colour" : "red",
"size" : "medium"
}
}
},
{
"refCode" : "RC124",
"qty" : 8,
"price" : 52.5,
"variant" : {
"attributes" : {
"colour" : "yellow",
"size" : "small"
}
}
}
],
"currency" : "GBP"
}
}Example using alternative product variant attributes (prearranged with Optimizely).
{
"type" : "basket",
"ip" : "10.42.37.139",
"session" : "155780550/hKugo5RQsqecUpmlWE6EpFWqmalVrJU",
"cuid" : "143159800/hKugo5RQsqecUpmlWE6Eo1OklrJYp5U",
"site" : "retailer",
"clientToken" : "1234abcd5678",
"channel" : "web",
"lang" : "en-gb",
"currentURI" : "www.retailer.com/basket.html",
"previousURI" : "www.retailer.com/product/RC123.html",
"userAgent" : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
"basket" : {
"items" : [
{
"refCode" : "RC123",
"qty" : 5,
"price" : 50.5,
"variant" : {
"attributes" : {
"segment" : "gold",
"country" : "en_GB"
}
}
},
{
"refCode" : "RC124",
"qty" : 8,
"price" : 52.5,
"variant" : {
"attributes" : {
"segment" : "platinum",
"country" : "en_GB"
}
}
}
],
"currency" : "GBP"
}
}