Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Prices with thousands separators parsed wrongly: how to fix it

TRK-353Medium impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

A thousands separator is the comma, dot or space that groups digits in large numbers: 1,299.50 in the US and UK, 1.299,50 in much of Europe, 1 299,50 in France. Humans read these easily. Code does not.

Tracking tags such as GA4, Google Ads and Meta expect value to be a number with a dot as the decimal point and no grouping. If your data layer or tag sends a string like "1,299.50", the platform may stop reading at the comma and record 1. If you send "1.299,50", it may read 1.299. Either way the order is counted, but with the wrong value.

It usually happens when a script copies the price from the page text (for example with innerText) and runs parseFloat on it, or when a theme outputs a formatted money string into the data layer.

Why it costs you leads or sales

The sale itself is not lost, but your reporting is. Orders under 1,000 look fine, so the bug hides. Orders of 1,000 or more, often your best customers, are under-reported by a large margin.

Smart bidding in Google Ads and Meta's optimisation learn from conversion values. If high-value orders arrive as tiny values, the algorithms learn that those buyers are worth little and shift budget away from them. Your ROAS (return on ad spend) also looks worse than it is, so you may cut campaigns that work.

Reported value of one orderExample numbers
Reported value of one order (example)Real order: 1,299.5 $; Sent as "1,299.50": 1 $; Sent as "1.299,50": 1.3 $; Sent as 1299.50: 1,299.5 $04989961,299.511.31,299.5Real orderSent as "1,299.50"Sent as "1.299,50"Sent as 1299.50$

Example: the same order sent in different formats. Only the plain number is read correctly.

Where the value goes wrong
  1. Customer paysOrder total 1,299.50
  2. Data layerPrice pushed as formatted text
  3. Tag reads valueParsed as 1 or 1.299
  4. Ad biddingLearns from wrong value

The break happens when the formatted price text becomes the tracking value.

How to check if your site has it

Test with a high-value order
  1. Pick a product above 1,000

    Use a real product priced at 1,000 or more, or a test product with a price like 1,234.56. Small prices will not reveal the bug.

  2. Open the data layer

    On the order confirmation page, open browser DevTools, go to Console and type dataLayer. Find the purchase event and look at the value or price fields.

  3. Check the type

    A number shows without quotes (1299.5). A string shows in quotes ("1,299.50"). Any comma, space or quoted number is suspect.

  4. Check what the platform received

    In GA4 DebugView, Tag Assistant or the Meta Pixel Helper, open the purchase event and read the value parameter. Compare it with the order total.

  5. Compare reports

    Compare your store's revenue for a week against GA4 and Ads. A gap that grows with order size points to this bug.

Quick console check for a bad valuejavascript
dataLayer.filter(e => e.event === 'purchase').forEach(e => {
  const v = e.ecommerce ? e.ecommerce.value : e.value;
  console.log(v, typeof v);
});

How to fix it

The principle is the same everywhere: take the raw numeric price from your platform, not the displayed text, and send it as a number.

Fix by platform
  1. Use the raw order total

    In WooCommerce, output $order->get_total() (a plain number string such as 1299.50) into the data layer, not wc_price() or formatted HTML. If a tracking plugin has a setting for price format or decimal separator, set it to dot with no thousands separator.

  2. Cast to a number

    Wrap the value with (float) in your PHP so it is output unquoted in JSON.

Clean a formatted price string (fallback)javascript
function toNumber(input) {
  if (typeof input === 'number') return input;
  var s = String(input).replace(/[^0-9.,-]/g, '');
  var lastComma = s.lastIndexOf(',');
  var lastDot = s.lastIndexOf('.');
  var decimalPos = Math.max(lastComma, lastDot);
  if (decimalPos === -1) return parseFloat(s);
  var digitsAfter = s.length - decimalPos - 1;
  if (digitsAfter === 3 && (lastComma === -1 || lastDot === -1)) {
    return parseFloat(s.replace(/[.,]/g, ''));
  }
  var intPart = s.slice(0, decimalPos).replace(/[.,]/g, '');
  var decPart = s.slice(decimalPos + 1);
  return parseFloat(intPart + '.' + decPart);
}
// toNumber('1,299.50') -> 1299.5
// toNumber('1.299,50') -> 1299.5

How to confirm it's fixed

Purchase value for a 1,299.50 order

Before

  • Data layer value is the string "1,299.50"
  • GA4 and Ads record a value of 1
  • ROAS looks far too low

After

  • Data layer value is the number 1299.5
  • GA4, Ads and Meta all record 1299.5
  • Revenue matches the store
Confirmation checks
  • Place a test order of 1,000 or more (use test mode where available).
  • The data layer value has no quotes, commas or currency symbols.
  • GA4 DebugView shows the exact order total.
  • Meta Pixel Helper and Tag Assistant show the same value.
  • Test a European-format store view or currency if you sell in several.
  • After 24 to 48 hours, daily revenue in GA4 and Ads is close to store revenue.

How to prevent it happening again

Prevention
  • Never read prices from visible page text for tracking.
  • Keep one documented data layer spec: value is a number, dot decimal, no grouping.
  • Always include a price of 1,000 or more in your test plan after theme, plugin or currency changes.
  • Re-test when you add a new currency or language, since formats change.
  • Compare store revenue with analytics revenue monthly and investigate gaps.

How FunnelGuard handles this

FunnelGuard detects this issue only partly. It runs your real checkout or lead journey on a schedule and checks that the tracking hits to GA4, Google Ads, Meta, TikTok, LinkedIn and other platforms are sent. That catches a purchase tag that stops firing, which is often the first sign something broke.

What it does not do is judge whether a value is right for a given price. FunnelGuard does not know that your robot's order of 1,299.50 should have been reported as exactly that, and it stops before payment unless your store's test mode is set up, so it will not generate a real high-value purchase for you.

To cover the rest by hand: add a test product priced above 1,000, run a test order in your store's test mode, and compare the data layer value and the value shown in GA4 DebugView or Tag Assistant with the order total. Repeat after any change to your theme, tracking plugin or currencies. FunnelGuard's free plan (1 site, 2 journeys, daily checks, no card) is a good way to keep the tracking hits themselves watched in between.

Questions people ask

Why is my GA4 purchase value 1 instead of 1299?

The value was most likely sent as a formatted string such as "1,299.00". The platform stops reading at the comma and records 1. Send the value as a plain number (1299.00) with no thousands separator.

Why is my Google Ads conversion value wrong for large orders only?

Orders below 1,000 have no thousands separator, so they parse correctly. Orders of 1,000 or more include a comma or dot that breaks parsing. Check that your data layer sends a numeric value, not formatted text.

How do I send a price without a thousands separator?

Use the raw price from your platform, such as WooCommerce get_total() or a Shopify price divided by 100, instead of a formatted money string. Output it as a number with a dot as the decimal. Format prices for display only, never for tracking.

Does parseFloat handle commas in prices?

No. parseFloat('1,299.50') returns 1 because it stops at the comma. Remove grouping characters first or, better, use the raw numeric value from your backend.

Why do my European prices like 1.299,50 track as 1.299?

European format uses a dot for thousands and a comma for decimals. Tracking platforms expect a dot as the decimal, so they read 1.299,50 as 1.299. Convert to 1299.50 before sending.

How can I tell if my tracking has this problem?

Test with a product priced at 1,000 or more and read the value in the data layer and in GA4 DebugView or Tag Assistant. If it differs from the order total, or shows in quotes with a comma, you have the bug.

Can FunnelGuard detect wrong price parsing?

Only partly. FunnelGuard checks that tracking hits fire along your journey, but it does not verify that a value matches the exact price. Run a manual test order with a price above 1,000 to check values.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.