How to pass item value and quantity to analytics?

Hi, I unable to pass the value and quantity of item with the code:
await analytics().logEvent(‘purchase’, {
value: parseFloat(amount),
currency: ‘USD’,
items: [
{
item_name: PRODUCT_NAME,
item_category: ITEM_CATEGORY,
price: parseFloat(amount),
quantity: 1
},
],
});

Screenshot 2020-11-20 at 11 48 10 AM

May I know any missing code from my part?

1 possible answer(s) on “How to pass item value and quantity to analytics?

  1. One person’s “problem” is another person’s “avoid IEEE Floating Point errors when dealing with monetary values at all costs by internally using an integer with enough significant digits to carry any sub-currency-unit partial amounts”

    Just sayin’ 🙂

How to pass item value and quantity to analytics?

Hi, I unable to pass the value and quantity of item with the code:
await analytics().logEvent(‘purchase’, {
value: parseFloat(amount),
currency: ‘USD’,
items: [
{
item_name: PRODUCT_NAME,
item_category: ITEM_CATEGORY,
price: parseFloat(amount),
quantity: 1
},
],
});

Screenshot 2020-11-20 at 11 48 10 AM

May I know any missing code from my part?

1 possible answer(s) on “How to pass item value and quantity to analytics?

  1. One person’s “problem” is another person’s “avoid IEEE Floating Point errors when dealing with monetary values at all costs by internally using an integer with enough significant digits to carry any sub-currency-unit partial amounts”

    Just sayin’ 🙂