I’m trying to track more information in GA4.
I have added this to my product template, to log events when someone views an item:
<script>
gtag("event", "view_item", {
currency: "GBP",
value: [[+product_info.price]],
items: [
{
item_id: "[[+product_info.sku]]",
item_name: "[[*longtitle:default=`[[*pagetitle]]`]]",
index: 0,
price: [[+product_info.price]]
}
]
});
</script>
But the price comes out in ‘cents’. e.g. a product which is £4.00 is displayed in the above tag as ‘400’. I thought I could use output modifiers to divide the value by 100, but if I try:
price: [[+product_info.price:div=`100`]]
I get no value at all.
Any idea?
Thanks!
Andy