Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GA4: Price is appended with multiple zeros

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

like image 392
Mohan Avatar asked Sep 05 '25 03:09

Mohan


1 Answers

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.

like image 140
Scott Gigante Avatar answered Sep 07 '25 23:09

Scott Gigante