Here are 3 solid options to fix the value field issue (being sent as a string instead of a number) in your Google Ads conversion tracking setup via Google Tag Manager (GTM):
Option 1: Use a Custom JavaScript Variable in GTM (Quick Fix)
Best for: Fast and simple correction in GTM
How:
In GTM, go to Variables → New → Custom JavaScript
Paste:
javascript
Copy
Edit
function() {
return Number({{DLV - ecommerce.value}});
}
Use this variable in your Google Ads Conversion Tag under the “Value” field.
Option 2: Convert the Value Inside the Tag Itself
Best for: When you prefer to keep fewer GTM variables
How:
In your Google Ads Conversion Tag, for the "Value" field, click the “+” to select a variable.
Click the "+" again → Create Custom JavaScript variable directly inside the tag field:
javascript
Copy
Edit
function() {
var val = {{DLV - ecommerce.value}};
return parseFloat(val);
}
This avoids creating a separate global variable.
Option 3: Fix the DataLayer at the Source (WooCommerce / GTM4WP)
Best for: Cleanest long-term fix, especially if multiple events (add_to_cart, purchase) send strings
How:
Go to WooCommerce → Settings → Integration → GTM4WP
Check if there's a setting to send numeric values (some setups allow this)
If not, you can hook into WooCommerce’s filters:
php
Copy
Edit
add_filter( 'gtm4wp_enhanced_ecommerce_product_price', function( $price ) {
return floatval( $price );
});
You may need dev help for this, but it cleans the data at the source.
Bonus: Test It!
Use Preview mode in GTM + Google Tag Assistant to ensure:
Your purchase tag fires
Value appears as a number (not string or undefined)