Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards

Product price is not capturing properly

Avatar

Level 3

Due to multi language website,, product price is coming in different formats. this is creating issue to get accurate price.

English language:

Price : 1416993.75

Non-English Language:

Price: 1,416,993,75

Anybody have any idea how to fix on the Adobe Launch side.

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

9 Replies

Avatar

Community Advisor and Adobe Champion

How are you picking up the price value? I assume this is being passed in a data layer, or through some data element on the purchase event?

 

I would be more tempted to work with your developers to pass you the information in a consistent format, no matter what language is being used on the site... they must be doing this anyway for passing to the payment provider... 

Avatar

Level 3

prince is available in data Layer. The problem is inconsistency, some places have comma separator & some places decimal with dot

Avatar

Community Advisor and Adobe Champion

That sounds like it should be a bug for your developers... 

 

While yes, you could try to write JS to convert the formatting, there is a greater potential to also break something... like converting the wrong thing. I would only do it myself as a temporary stop gap (like if I had to wait a long time for a fix) or if the ticket to fix it wasn't going to be prioritized by the development team...

 

They are the ones responsible for sending you the correct information, and inconsistencies like you describe should be up to them to fix.

 

It's possible this was never explicitly written into the original requirements, but rather assumed that the data would be consistent... either way, this is still an issue with the source data.

 

 

The JavaScript provided by @Vinay_Chauhan, while a valiant attempt.. will actually be problematic...

 

Your examples above:

1416993.75 will be returned as "141699375" (definitely wrong)

1.416.993,75 will be returned as "1416993.75" (this is fine)

1,416,993.75 will be returned as "1.416" (also wrong)

 

There are too many potential variations you have to deal with... and that is supposing that everything will always be returned with cents (i.e. 1,416,993.00 vs 1,416,993)

 

It's always safer to have your developers handle this, particularly since they should already be sending consistent data to your payment handler.... 

Avatar

Community Advisor

Hi @DineshRkumar 

To standardize price formatting before sending to Adobe Analytics via Launch, you can add a data element or custom code to clean and normalize the price value across all languages. Here’s a simple approach using a custom JavaScript data element -

function normalizePrice(rawPrice) {
// Replace comma with nothing if it's used as a thousand separator
// Then replace the locale-specific decimal with dot
let cleanPrice = rawPrice.replace(/\./g, '').replace(/,/g, '.');
return parseFloat(cleanPrice);
}


You can use this function inside a Custom Code action in Launch, or attach it to the data element that handles the product price. Make sure the logic aligns with how your site formats prices per locale.

Also, double-check that the raw price being scraped is not a string with currency symbols or HTML wrappers, sometimes stripping tags or symbols helps before parsing.

Hope that helps!

Avatar

Community Advisor

Hi @DineshRkumar ,

 

Inconsistent number formats across languages/locales (like commas vs dots for decimal or thousand separators) can break price accuracy in Adobe Analytics, especially if you're sending raw data from the data layer without normalization.

Since the product price is available in the data layer, the best fix is to standardize the format in Adobe Launchbefore sending it to Adobe Analytics.

 

  • English: 1416993.75 → Correct format
  • Other locales: 1.416.993,75 or 1,416,993,75 → Adobe interprets this as a string, not a number.
  • Analytics expects . as the decimal separator and no thousand separators.
How to Apply in Launch
  1. Create a Data Element: normalizedPrice
    • Type: Custom Code
    • Paste the normalizePrice() logic
  2. Use in Adobe Analytics Rule
    • e.g., s.products = ";productName;1;" + _satellite.getVar("normalizedPrice")

Sample code for normalization function:

function normalizePrice(rawPrice) {
// Convert to string just in case
var priceStr = rawPrice.toString().trim();

// Detect and replace comma as decimal
if (priceStr.match(/,\d{2}$/)) {
// Replace thousand separators (dot or comma) with nothing
priceStr = priceStr.replace(/[.,](?=\d{3}([.,]))/g, '');
// Replace last comma with dot for decimal
priceStr = priceStr.replace(/,(\d{2})$/, '.$1');
} else {
// Remove comma thousand separators
priceStr = priceStr.replace(/,/g, '');
}

return parseFloat(priceStr);
}

// Example usage
var rawPrice = window.digitalData.product.price; // Or your data element
var normalizedPrice = normalizePrice(rawPrice);

// Store normalized price in a Launch data element or eVar/prop
_satellite.setVar('normalizedPrice', normalizedPrice);

 

 

Some Tips:

Situation
Action
Locale-based price formatting
Normalize before sending to Analytics
Server-side tag deployment
Do normalization upstream
Tagging multiple currencies
Also include currencyCode for clarity

 

Avatar

Level 5

You're dealing with inconsistent price formats in the data layer due to locale differences (e.g., 1.416.993,75 vs 1416993.75). To fix this in Adobe Launch, create a Custom Code Data Element that:

-Reads the raw price from the data layer.
-Normalizes it by removing thousand separators and converting the decimal to a dot (.).
-Returns a clean float value (e.g., 1416993.75).

Use this normalized value in your analytics tags for consistency.

Avatar

Level 4

Hi @DineshRkumar,

Although, this should probably be fixed by the site developers in the data layer so that the value is consistent, this isn't always possible. I would first try and get the developers to mend it but if they can't or won't then I would go with  the following approach.

Create a data element that will return the price but run a function to make the data uniform.

function cleanPriceValue(priceStr) {
  if (typeof priceStr !== 'string' || !priceStr.trim()) return null;

  // Normalize to remove Unicode non-breaking spaces and similar
  priceStr = priceStr.normalize('NFKD').replace(/\s|\u00A0|\u202F/g, '');

  // Remove all characters except digits, commas, and periods
  const cleaned = priceStr.replace(/[^\d.,]/g, '');

  // Handle various number formats
  let normalized;

  // Format: 1.234,56 (EU style)
  if (/^\d{1,3}(\.\d{3})+,\d{2}$/.test(cleaned)) {
    normalized = cleaned.replace(/\./g, '').replace(',', '.');

    // Format: 1,234.56 (US style)
  } else if (/^\d{1,3}(,\d{3})+\.\d{2}$/.test(cleaned)) {
    normalized = cleaned.replace(/,/g, '');

    // Format: 1234,56 (EU simple)
  } else if (/^\d+,\d{2}$/.test(cleaned)) {
    normalized = cleaned.replace(',', '.');

    // Format: 1234.56 (already correct)
  } else if (/^\d+\.\d{2}$/.test(cleaned)) {
    normalized = cleaned;

    // Format: 1.000 or 1,000 (assumed thousands)
  } else if (/^\d{1,3}([.,]\d{3})+$/.test(cleaned)) {
    normalized = cleaned.replace(/[.,]/g, '');

    // Fallback: remove everything non-digit
  } else {
    normalized = cleaned.replace(/[.,]/g, '');
  }

  // Parse to float
  const value = parseFloat(normalized);
  return isNaN(value) ? null : value;
}


Run the function with the following code, but replace the input with your data layer reference:

Let dataLayerPrice = "1,234.56";
return cleanPriceValue(dataLayerPrice)

 

 

Here is how the code will perform with the different inputs:

Input => Output

1.234,56 => 1234.56
1,234.56 => 1234.56
1234,56 => 1234.56
1234.56 => 1234.56
1 234,56 => 1234.56
₹1,23,456.78 => 123456.78
¥123,456 => 123456
USD 1,000.00 => 1000
abc123,45xyz => 123.45
12.50 => 12.5
12,50 => 12.5
1.000 => 1000
1,000 => 1000
123456 => 123456

 

Thanks,

Dan

Avatar

Community Advisor

Hi @DineshRkumar ,

to be completely blunt, this is a sh*t in, sh*t out situation that should not be resolved by you in the first place, but by the developers. 
Are you certain that the numeric value is not around on the website, since quite often formatting happens in the frontend based on browser locales.

So my suggestion is reaching out to the developers first before adding complex clean up logic on your end.

You as tag management specialist can also make demands in terms of data quality, and I'm certain that you will find business people who have your back on this.

 

You need a numeric value, simple as that. Formatting characters that improve readability are turning you numeric into a string value.

Cheers from Switzerland!


Avatar

Level 6

Create a new Data element 
Custom Code 

return function(priceString) {
  if (!priceString || typeof priceString !== "string") return 0;

  // Remove any spaces and non-breaking spaces
  priceString = priceString.replace(/\s/g, '');

  // Replace comma if used as decimal separator (assumes last comma is decimal)
  // and remove other thousands separators (periods or commas)
  // Example: "1.416.993,75" => "1416993.75"
  let normalized = priceString
    .replace(/\.(?=\d{3})/g, '')     // remove dot thousand separators
    .replace(/,(?=\d{2}$)/, '.');    // replace decimal comma with dot

  // Parse as float
  return parseFloat(normalized) || 0;
}(digitalData.product.price); // Replace with your actual variable path

You may need to adjust the regex if your locale uses different formats

Or you can do is Transform the Price Inside a Rule (Set Variables Action)
In the “Set Variables” action for Adobe Analytics, instead of directly using product_price, use custom code:

var rawPrice = _satellite.getVar('product_price');
if (typeof rawPrice === 'string') {
  rawPrice = rawPrice.replace(/\.(?=\d{3})/g, '').replace(/,(?=\d{2}$)/, '.');
}
s.eVarX = parseFloat(rawPrice) || 0;



Let me know which one works for you!