Round number fields
Round number fields
This is for:
DeveloperIn this article
In this article, we’ll show you how to use the correct rounding in emitting QP event fields of the type number.
Intro
In the following example, we see the field product.price.value
with the value 66
.
This value must be rounded to a maximum of 2 decimal places, so 66
and 66.00
are both valid rounding examples.
uv.emit('ecProduct', {
eventType: 'listing',
product: {
sku: 'sso-154',
productId: '120039504',
name: 'Blue sweater',
price: {
currency: 'GBP',
value: 66
}
}
})
Refer to the following examples.
Good examples
price: {
value: 55,
currency: "USD"
}
price: {
value: 55.55,
currency: "USD"
}
Bad examples
Too many numbers after .
:
price: {
value: 55.555,
currency: "USD"
}