Enhanced Conversions (Web) Code Generator for gtag and GTM

Build the gtag('set', 'user_data') code or the Tag Manager variable for enhanced conversions for web — with Google's exact field names, E.164 phones and blank fields left out — or check the code you already have.

Runs in your browser. Nothing is uploaded.For Google

Enhanced Conversions Code Generator for Google Ads

1 Build or check

What do you want to do?

Sent as the 2-letter ISO code. Also used to add the country code to phone numbers typed without +.

Customer fields — a variable name or CSS selector each. Leave a field empty if you don't collect it.
Optional: test one customer's values (they stay in this browser)

See the normalized value and its SHA-256 hash — compare with what your server or plugin sends.

2 Your enhanced conversions code / check results

Fill in the settings above — your result appears here instantly.

Next step Enhanced conversions ride on your conversion tag — build the event snippet with value, currency and transaction ID.

Build the conversion tag

Rules last checked: against the official pages:

How to use the gtag enhanced conversions generator

Gtag enhanced conversions need one extra piece of code on the conversion page: a user_data object with the customer's email, phone or address. This generator writes it with the key names and formats from Google's page Set up enhanced conversions for web using the Google tag.

  1. Pick your setup: the Google tag in your page code, or Google Tag Manager.
  2. Say where the data lives. On a thank-you page it is usually in JavaScript variables printed from the order. On a lead form that fires the conversion when it is sent, the code reads fields such as #email at the moment of submit.
  3. Fill only the fields you collect. An email alone is enough. Address matching needs first name, last name, postal code and country together.
  4. Choose the country. It becomes the ISO code, and phones typed without + get its country code.
  5. Copy and check. Paste box 1 above the conversion snippet, or use Check my code on an existing setup.
gtag enhanced conversions generator showing a user_data snippet with email, phone and address fields and passed checks

What to do next: install the code and turn the feature on

Switch the feature on in Google Ads under Goals › Settings and accept the customer data terms — until then Google ignores the data. Then add the code where your conversion fires:

Plain HTML

  1. Have your server print the customer's details into JavaScript variables on the confirmation page, with the names you typed above.
  2. Paste box 1 between the Google tag and the gtag('event', 'conversion', …) line — user data must be set first.

To confirm it works, make a test conversion and open the network tab: the request to googleadservices.com/pagead/conversion/ should carry em=tv.1~em followed by a long string. Impact reporting appears about 30 days after a good setup.

Common enhanced conversions errors and fixes

Enhanced conversions needs attention: empty data

If the request shows only tv.1~em, the tag fired before the variables were filled or after the form values were gone. Run the code where the data is present.

Enhanced conversions user_data phone number format

Google wants E.164: plus sign, country code, digits only, like +14155550123. The generated code strips spaces, dashes, brackets and a (0), adds your country code only when it is missing, and drops numbers it can't fix.

Blank fields sent as empty strings

Google asks you to remove a field you don't have rather than send "". The generated code deletes empty values when it runs, so a skipped phone field sends nothing.

Keys Google doesn't read

phone, zip or a first_name outside address are ignored. Use phone_number and postal_code, and nest name and address fields inside address.

Numbers instead of text

Every value must be a string, so a ZIP code passed as the number 94105 breaks the rule. The generator wraps each value in String().

Frequently asked questions

What are enhanced conversions for web?

A Google Ads feature that sends customer details your site already has — usually the email from checkout or a form — along with the conversion tag. Google hashes them with SHA-256 and uses them to connect the conversion to the person who clicked your ad.

How do I set up enhanced conversions with the Google tag (gtag.js)?

Turn the feature on in Google Ads (Goals › Settings) and accept the customer data terms. Then add gtag('set', 'user_data', {…}) to the conversion page, after the Google tag and before the conversion event snippet.

Do I need to hash emails before sending user_data?

No. Plain values are fine — Google normalizes and hashes them. To send hashes instead, use the sha256_ keys and normalize first: trim, lowercase, phone in E.164, and no dots before the @ in gmail.com and googlemail.com addresses.

Why does Google Ads say enhanced conversions needs attention?

Most often the tag fires with empty data, the customer data terms were not accepted, ad_user_data consent was denied, or the conversion action is imported from Google Analytics, which enhanced conversions doesn’t support. Diagnostics update after about 48–72 hours.

What is the difference between enhanced conversions for web and for leads?

Web sends the data with the tag when the sale happens on your site. Leads matches offline sales you upload later by hashed email or phone — see our enhanced conversions for leads CSV builder. Since June 2026 both are one on/off setting.

Can I set up enhanced conversions in Google Tag Manager?

Yes, with a User-Provided Data variable: automatic detection, manual CSS selectors or data layer variables, or a Custom JavaScript variable (the Code option). Choose Google Tag Manager above to get that variable.

Need help setting this up? Talk to EmproIT