Get More from Your Google LSA Text Us at (628) 228-6704
0 like 0 dislike
437 views
by Marketing Guru (9.7k points)

What are the best options to fix the value field issue (being sent as a string instead of a number) in a Google Ads conversion tracking setup using Google Tag Manager (GTM)?

1 Answer

0 like 0 dislike
by Marketing Guru (6.3k points)

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)

Join a specialized Q&A site for digital marketing experts focused on ad platforms like Google, Facebook, YouTube, LinkedIn, Bing, Quora, and more. Connect with peers to share strategies on client retention beyond acquisition. Discuss and solve technical, managerial, or general challenges to improve your ad campaigns and client relationships.

Register to unlock your digital marketing potential!
Get More from Your Google LSA
Text Us at (628) 228-6704
...