GA4: Price is appended with multiple zeros
Asked Answered
K

1

28

While using GA4 view_cart, begin_checkout, add_payment_info events for Item array Price parameter is appending multiple zeros in GA debug view.

For example: we are sending price as below for items

gtag('event', "view_cart", {
   currency:'MXN',
   items:[
      {
         "item_id":"84162903",
         "item_name":"Multipack Magnum Mini Cl\u00e1sica 60ml",
         "quantity":14,
         "affiliation":"MI16",
         "discount":0,
         "item_brand":"Magnum",
         "item_category":"Multipack",
         "item_variant":"",
         "price":24040.8,
         "currency":"MXN",
         "coupon":null
      },
      {
         "item_id":"68199453",
         "item_name":"Pinta Magnum Almendras 440ML",
         "quantity":14,
         "affiliation":"MI16",
         "discount":0,
         "item_brand":"Magnum",
         "item_category":"Helado",
         "item_variant":"",
         **"price":9570.96**,
         "currency":"MXN",
         "coupon":null
      },
      {
         "item_id":"67536209",
         "item_name":"Magnum Double Caramelo 93ML",
         "quantity":14,
         "affiliation":"MI16",
         "discount":0,
         "item_brand":"Magnum",
         "item_category":"Paletas",
         "item_variant":"",
         "price":7654.5,
         "currency":"MXN",
         "coupon":null
      },
      {
         "item_id":"209045",
         "item_name":"Magnum Mini Almendras Multipack",
         "quantity":14,
         "affiliation":"MI16",
         "discount":0,
         "item_brand":"Magnum",
         "item_category":"Paletas",
         "item_variant":"",
         "price":7295.4,
         "currency":"MXN",
         "coupon":null
      }
   ],
   value:48311.66,
   cartQty:56
})

and appears as price: 9570960000. Even for non-decimal numbers the 0 are appended.

Expected: 9570.96

This gives wrong value. How to make this correct?

enter image description here

Kuykendall answered 23/4, 2021 at 6:16 Comment(2)
I believe internally the value is multiplied by 1000000 so it can be stored as an integer (saves space) and the debug tool has forgotten to convert it back. Real reports seem to get it right.Lyris
I lost a few hours of my life trying to work this one out. I had the exact same problem. My reports do show the correct pricing. Hope the GA4 devs fix this one.Digged
B
24

Per comment by Tony McCreath:

This is a non-issue in real reports and only appears in DebugView.

Internally the value is multiplied by 1000000 so it can be stored as an integer to save space. The debug tool fails to convert it back, but real reports seem to get it right.

Botryoidal answered 23/4, 2021 at 6:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.