Hi there,
It seems that the gtag code for Swift uses default (currency) formatting which breaks standard JavaScript. For example, on one site I have, this code:
<script> gtag("event", "begin_checkout", { currency: "@GetString("Ecom:Order.CurrencyCode")", value: @GetString("Ecom:Order.Price.Price.Value"), items: [ @foreach (LoopItem orderline in GetLoop("OrderLines")) { <text> { item_id: "@orderline.GetString("Ecom:Order:OrderLine.ProductID")", item_name: "@orderline.GetString("Ecom:Order:OrderLine.ProductName")", currency: "@orderline.GetString("Ecom:Order:OrderLine.UnitPrice.CurrencyCode")", price: @orderline.GetString("Ecom:Order:OrderLine.TotalPriceWithProductDiscounts.Price.Value"), quantity: "@orderline.GetString("Ecom:Order:OrderLine.Quantity")" }, </text> } ] }); </script>
renders output like this:
<script>
gtag("event", "begin_checkout", {
currency: "EUR",
value: 13,85,
items: [
{
item_id: "6722330",
item_name: "Some name",
currency: "EUR",
price: 8,9,
quantity: "1"
},
]
});
</script>
gtag("event", "begin_checkout", {
currency: "EUR",
value: 13,85,
items: [
{
item_id: "6722330",
item_name: "Some name",
currency: "EUR",
price: 8,9,
quantity: "1"
},
]
});
</script>
The value and price result in invalid decimals, causing the browser to throw exceptions. This then causes other JavaScript on the page to fail as well.
Can this be fixed?
Thanks!
Thanks!