On this page
What this issue is
GA4 ecommerce events (view_item, add_to_cart, begin_checkout, purchase) carry an items array. Each item has fields such as item_id, item_name, quantity and price. The price field must be a number. The currency goes in the event-level currency field as an ISO code like USD or EUR.
// Wrong
items: [{ item_id: "SKU-1", item_name: "Mug", price: "$19.99", quantity: 1 }]
items: [{ item_id: "SKU-1", item_name: "Mug", price: "19,99", quantity: 1 }]
// Right
currency: "USD",
items: [{ item_id: "SKU-1", item_name: "Mug", price: 19.99, quantity: 1 }]Why it costs you leads or sales
- Product pagePrice shown as $19.99
- dataLayer pushprice: "$19.99" (text)
- GA4 eventPrice ignored or read as 0
- Revenue reportsItem revenue wrong
- Ad biddingLearns from wrong values
The sale happens, but the value is lost on the way to your reports and ad platforms.
Example: a store with $10,000 of real sales in a week, where GA4 only counts items whose price was sent as a number.
How to check if your site has it
Open GA4 DebugView
In GA4 go to Admin > DebugView. Turn on debug mode with Google Tag Assistant or the GA debugger extension, then browse a product and add it to the cart.
Open the event and its items
Click add_to_cart or purchase, then expand the items parameter. Check that price is present and shown as a number.
Check the dataLayer in the browser
Open DevTools > Console and type
dataLayer. Find the ecommerce push and look at price. Quotes around the value mean it is text.Compare with your reports
In Reports > Monetisation > Ecommerce purchases, look for products with purchases but zero item revenue.
dataLayer.filter(e => e.ecommerce && e.ecommerce.items).forEach(e => {
e.ecommerce.items.forEach(i => console.log(e.event, i.item_id, typeof i.price, i.price));
});
// typeof must be "number"How to fix it
Find the source
Identify which plugin pushes ecommerce data (for example a WooCommerce GA4 plugin or your theme). Update it first, as many price bugs are fixed in newer versions.
Check plugin settings
Look for options about price format, tax display or tracking of displayed prices. Choose the option that sends raw product prices.
Custom code
If you push your own data, use
(float) $product->get_price()in PHP instead ofwc_price()orget_price_html(), which return formatted text.
Find the code that builds the data
Check theme files or your tracking app for the dataLayer push. In Liquid, use the price filter without formatting.
Use a raw number
Use
{{ item.price | divided_by: 100.0 }}without quotes. Do not usemoneyfilters, which add symbols.
Create a Custom JavaScript variable
Under Variables, add a Custom JavaScript variable that cleans the price, for example the function below, and test it in Preview mode.
Use it in the GA4 event tag
If you build items in the tag, map the cleaned value to price. If the dataLayer holds the items, clean them in a variable that returns a new items array.
Check custom code
Find the script in Project Settings > Custom Code or on the page that builds the items. Read price from a data attribute holding a plain number, not from the displayed text.
Convert before sending
Use the parsing function below to strip symbols before pushing.
Check the integration
If you use the built-in Google Analytics connection, test in DebugView. If you use custom code in Settings > Custom Code, apply the parsing function below.
Check code injection
If you add your own tracking in Settings > Advanced > Code Injection, make sure the price comes from a number and not from page text.
Send numbers from the server
Output price from the database value as a number in the page or API response. Never read it from formatted markup.
Parse as a fallback
If you must read formatted text, clean it with a function and check for NaN before pushing.
function toPrice(v) {
if (typeof v === 'number') return v;
var s = String(v).replace(/[^0-9.,-]/g, '');
// 1.299,50 (comma decimal) vs 1,299.50 (dot decimal)
if (/,\d{1,2}$/.test(s)) s = s.replace(/\./g, '').replace(',', '.');
else s = s.replace(/,/g, '');
var n = parseFloat(s);
return isNaN(n) ? undefined : Math.round(n * 100) / 100;
}
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: 'add_to_cart',
ecommerce: {
currency: 'USD',
value: 19.99,
items: [{ item_id: 'SKU-1', item_name: 'Mug', price: toPrice('$19.99'), quantity: 1 }]
}
});Before
- price: "$19.99"
- Currency symbol inside the value
- GA4 may ignore the price
- Item revenue shows 0
After
- price: 19.99
- currency: "USD" sent separately
- GA4 reads the value
- Item revenue matches orders
How to confirm it's fixed
Retest in DebugView
Run through view_item, add_to_cart and a test order. Each item should show price as a number.
Run the console check
The typeof check should print "number" for every item.
Test other currencies and locales
If your store supports more than one currency or language, test each, since comma decimals break most often there.
Check reports after a day
Standard GA4 reports can take 24 to 48 hours. Confirm products now show item revenue.
How to prevent it happening again
- Read prices from raw data, never from displayed text
- Send currency as a separate ISO code
- Re-test ecommerce events after theme, plugin or checkout changes
- Test each currency and language version of the store
- Keep one documented place where the ecommerce dataLayer is built
- Check DebugView after every release that touches product or cart templates
How FunnelGuard handles this
Questions people ask
Why is my GA4 item revenue showing 0?
A common cause is that item price is sent as text, such as "$19.99", instead of a number. Other causes are a missing price, quantity of 0, or an items array that is not sent. Check one event in DebugView and expand the items parameter.
Should GA4 price include the currency symbol?
No. Send price as a plain number like 19.99. Put the currency in the separate currency field as a three-letter code such as USD, EUR or GBP.
Can GA4 price be a string like "19.99"?
It is safer to send a number. Text in quotes can be handled inconsistently, and values with symbols or comma decimals are often dropped. Convert to a number before sending to avoid guesswork.
How do I convert a price string to a number in Google Tag Manager?
Create a Custom JavaScript variable that removes symbols, handles comma or dot decimals and returns a number with parseFloat. Use it for the price field and check it in Preview mode. Better still, fix the source so the dataLayer holds a raw number.
How do I check what price GA4 received?
Open Admin > DebugView, trigger the event with debug mode on, and expand the items parameter on the event. You can also type dataLayer in the browser console and inspect the ecommerce push.
Do I use a comma or a dot for decimals in GA4 prices?
Use a dot, as in 1299.50. Do not add thousands separators. Sending "1,299.50" or "1299,50" can cause the value to be misread or ignored.
Does this affect Google Ads conversion value?
It can. If the purchase value or the item prices are wrong, conversion values imported from GA4 or sent from the same data layer can be wrong too, which affects value-based bidding.
Can FunnelGuard detect a price sent as a string?
Only partly. FunnelGuard checks that your funnel steps and tracking hits work on a schedule, but it does not claim to validate the data type of each item price. Cover that by hand with DebugView and the console check.
Related issues
- TRK-082purchase value differs from order totalFix guide
- TRK-081purchase value includes or excludes tax/shipping inconsistentlyFix guide
- TRK-083items array missing from ecommerce eventsFix guide
- TRK-084items missing item_id or item_nameFix guide
- TRK-095Currency on items differs from event currencyFix guide
- TRK-092Old UA enhanced ecommerce schema pushed instead of GA4 schemaFix guide