Get More Local Leads with Google Local Services Ads — Plans Start at $600/Month
0 like 0 dislike
292 views
by Marketing Guru (8.1k 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 Campaign Wizard (5.5k 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 Local Leads!
Google Local Services Ads
Starting at $600/Month

Most popular tags

google-ads facebook-ads meta-ads amazon-fba amazon-ads amazon-seller-help youtube-ads ad-campaigns x-ads amazon-2026 pinterest-ads performance-max paid-advertising glsa amazon-storefront ppc-strategy amazon-ppc amazon-seller-account twitter-ads local-service-ads server-side-tracking tiktok-ads conversion-tracking ppc-marketing google-analytics google-tag-manager server-side-tagging ppc ga4 dv-360 google-business-profile campaign-optimization facebook-pixel white-label-agency dynamic-keyword-insertion tools-to-find-keywords microsoft-advertisement feature-snippet-types meta-threads white-label-advertising convertion-tracking feature-snippet performance-marketing-agency pinterest-conversion-lift-study amazon-ungatedwholesale advantage-plus keyword-research shopify bing-ads-ppc video-ads ad-performance amazon-listing marchupdate2026 ppc-optimization metabusinessmanager landing-page mcc-google youtube-trueview-ads google-ads-calls-from-website-conversion pitch-digital-marketing-services pitch-deck-creation tiktok2026 sales-tax-exemptions audience-targeting ad-optimization ppc-landing-page learning-phase creative-testing google-merchant-listings google-local-service-ads disclosure-rule amazon-fbm ahrefs-keyword-difficulty display-ads demand-gen-campaigns dropshipping clickable-ads gtm amazon-product-listing budget-management creative-optimization looker-studio-report trend-genius-ai pinterest-carousel-ads bing-ads-management ppc-campaigns meta-carousel-ads pmax-campaigns campaign-structure microsoft-ads ad-creatives lead-generation landing-page-optimization advantage-campaigns microsoft-advertising-editor search-ads phased-campaign-strategy digital-marketing-tips digital-advertising negative-keywords
...