Set up enhanced conversions for web using the Google tag

Enhanced conversions for web is a feature that can improve the accuracy of your conversion measurement. It supplements your existing conversion tags by sending hashed first-party conversion data from your website in a privacy safe way. The feature uses a secure one-way hashing algorithm called SHA256 on your first-party customer data, such as email addresses, before sending to Google. The hashed data is then matched with signed-in Google accounts in order to attribute your campaign conversions to ad events, such as clicks or views.

This article describes how to set up enhanced conversions for web using the Google tag. You can also set up enhanced conversions for web with Google Tag Manager or set up enhanced conversions for web with Google Ads API.

Note: Conversions measured by importing Google Analytics goals aren't supported for enhanced conversions. If you'd like to use enhanced conversions, consider setting up a new Google Ads conversion action with the Google tag or Google Tag Manager.

Before you begin

Review the following requirements before starting setup:

  • Know the conversion page URL where the conversion tag fires (such as the confirmation page URL) and the conversion event trigger (for example, a button click or a page view).
  • This implementation requires knowledge of how conversion tracking is set up on your website and some code changes, so make sure you're able to speak with your development team as needed.
  • Ensure that you've reviewed and confirmed that you can comply with the enhanced conversion Customer data policies in Google Ads (view steps on this below, under Instructions).
  • If you set up conversion using URL, you can only set up enhanced conversions using the JavaScript or CSS selectors options or automatic enhanced conversions.
  • About 30 days after implementing enhanced conversions successfully, you’ll be able to see the impact results in your conversion action table. Learn more about Enhanced conversions for web impact results.

Instructions

  1. In your Google Ads account, click the Goals icon Goals Icon.
  2. Click the Conversions drop down in the section menu.
  3. Click Settings.
  4. Expand the “Enhanced conversions” section.
  5. Check “Turn on enhanced conversions for web”.
  6. Review compliance statement. To enable enhanced conversions you must confirm that you'll comply with our policies and that the Google Ads Data Processing Terms apply to your use of enhanced conversions. Click Agree and continue to acknowledge your acceptance of these terms.
  7. Click the dropdown to choose a method for setting up and managing user-provided data. Select “Google tag”.

    Note: If you send Google enhanced conversions data in a way that’s different from what you’ve already selected in Google Ads, that data may not be processed. For example, if you select “Google tag” and try to send data through Google Ads API, the data sent through API won’t be processed.

  8. If you’re not sure which tagging method to select, click Which method should I use? Enter your website domain and click Check URL to view suggestions.
  9. If you see a message stating that “your tag will collect user-provided data from your website” then you can immediately click Save to complete your setup.
  10. If you don’t see the message above, or if you’d like to learn about other methods for configuring enhanced conversions, click Tag details.
  11. On the tag details screen, you can decide how you’d like to capture user-provided data in your tag:
    1. Automatically detect user-provided data: Automatically inspect the page for strings that match a pattern for the configured data types. This method requires minimal effort and works well for most advertisers. For more control, consider adding a code snippet to your website or specifying CSS selectors or Javascript variables. You can specify CSS selectors to be excluded when automatic detection is turned on by clicking “add exclusions”.
    2. Specify CSS selectors or Javascript variables: Manually specify CSS selectors or Javascript variables on your page that contain relevant user-provided data. If you’d like to use this method, select this option and follow the instructions below.
    3. Add a code snippet to your website: Add a code snippet on your website that sends hashed customer data for matching. This method improves the accuracy of enhanced conversions by ensuring that you consistently send properly formatted data whenever your conversion tag fires. If you use this method you don’t have to select a checkbox under “Tag details”–we’ll automatically process any user-provided data you send us through a code snippet. If you’d like, you can use a combination of options. For example, you can select “Automatically detect user-provided data” to apply automatic detection across all your conversion actions and use a code snippet for specific conversion events of your choosing. Data provided through a code snippet is prioritized over automatically detected data. See more instructions below in “Add a code snippet to your website”.
  12. Click Save.
  13. After you complete setup, validate your implementation to make sure enhanced conversion is set up correctly. After about 30 days you’ll be able to view the impact of enhanced conversions on your reporting. Learn more about Enhanced conversions for web impact results.
Note: If you use either the automatic method or the CSS selector / Javascript variable method, Google will by default use an ads cookie to collect hashed, first-party customer data on your behalf and connect that data with subsequent conversion events occurring within the same user session. If you implement Consent Mode, the ads cookie will be subject to the ad_storage consent status of the Consent Mode feature, where implemented. You can disable this feature at any time by clicking the tools icon in the top right corner of your account, clicking “Google tag”, and switching off “form interactions” in your tag configuration.

Add a code snippet to your website

Before following the instructions below, make sure you’ve completed the steps in set up enhanced conversions and that you’ve selected “Google tag” as your data source.

Identify and define your enhanced conversions fields

Ensure the fields you need like email, address, and phone number are available on the conversion page where the Google Ads event snippet fires. This will likely be the case on conversion pages for purchases, sign-ups, and other similar conversion types, which often require customer data. If you're unsure which page this is, you should contact your developer.

Note: At least one of the following fields must be provided:
  • Email (preferred)
  • Address (first name, last name, postal code, and country are required). You can optionally provide street address, city, and region as additional match keys.
  • A phone number can also be provided along with an email or full name and address

You can either send unhashed data, which Google will normalize and hash before the data reaches the servers, or normalized and hashed data. If you decide to normalize and hash the data, follow the below instructions.

For normalization:

  • Remove leading or trailing whitespaces.
  • Convert the text to lowercase.
  • Format phone numbers according to the E.164 standard.

For hash:

The table below lists more information about the fields you can define. The “Key Name” column indicates how they'll be referenced in the enhanced conversions HTML snippet, which is created in the next step. Note, all data should be passed as String types.

Data Field Key Name Description
Email address email

User email.

Example: ‘jdoe@example.com’

sha256_email_address

Hashed user email.

Example:

‘a8af8341993604f29cd4e0e5a5a4b5d48c575436c38b28abbfd7d481f345d5db’

Phone number phone_number

User phone number. Must be in E.164 format, which means it must be 11 to 15 digits including a plus sign (+) prefix and country code with no dashes, parentheses, or spaces.

Example: ‘+11231234567’

sha256_phone_number

Hashed user phone number.

Example:

‘e9d3eef677f9a3b19820f92696be53d646ac4cea500e5f8fd08b00bc6ac773b1’

First name address.first_name

User first name.

Example: 'John'

address.sha256_first_name

Hashed user first name.

Example:

‘96d9632f363564cc3032521409cf22a852f2032eec099ed5967c0d000cec607a’

Surname address.last_name

User last name.

Example: 'Doe'

address.sha256_last_name

Hashed user last name.

Example:

‘799ef92a11af918e3fb741df42934f3b568ed2d93ac1df74f1b8d41a27932a6f’

Street address address.street User street address. Example: '123 New Rd'
City address.city User city name. Example: `Southampton’
Region address.region User province, state, or region. Example: `Hampshire’
Postal code address.postal_code User post code. Example: 'SO99 9XX'
Country address.country User country code. Example: 'UK'. Use 2-letter country codes, per the ISO 3166-1 alpha-2 standard.
Note: You’ll need to make sure the customer data is available when the conversion tag fires. If the user information is collected on a previous page, you’ll need to make sure it’s available in your code on the conversion page to configure it in this script.

Implement the enhanced conversions script

Configure and add the following script on your conversion page where the Google Ads event snippet is installed. Ensure that you update variable names below to match the variable names for those attributes on your web page.

For example, if you store email in a variable named “email_address” then the snippet should be edited to reflect that (for example, where it says yourEmailVariable).

Note: You can also hardcode the field with a string or use a function instead of using variables.

// Implement

<script>
gtag('set', 'user_data', {
"email": yourEmailVariable, ***Change yourEmailVariable to the actual Javascript variable name where you are storing the user’s email data. Do the same for the other variables below. Make sure the values aren't hashed.
"phone_number": yourPhoneVariable,
"address": {
"first_name": yourFirstNameVariable,
"last_name": yourLastNameVariable,
"street": yourStreetAddressVariable,
"city":yourCityVariable,
"region": yourRegionVariable,
"postal_code": yourPostalCodeVariable,
"country": yourCountryVariable
}
});
</script>

The phone number must be in E.164 format, which means it must be 11 to 15 digits including a plus sign (+) prefix and country code with no dashes, parentheses, or spaces.

If your site doesn't collect one of the above fields, remove the field entirely rather than leaving it blank. For example, a website that only collects emails and phone numbers would look like this:

// Implement
<script>
gtag('set', 'user_data', {
"email": {{ yourEmailVariable }},
"phone_number": {{ yourPhoneVariable }}
});
</script>
Note: At least one of the following fields must be provided:
  • Email (preferred)
  • Address - For address, first name, last name, postal code, and country are required. You can optionally provide street address, city, and region as additional match keys.
  • Phone number (must be provided in conjunction with email, or full name and address)

Multiple values

Developers can optionally provide multiple values (up to 3 for phone and email and 2 for address) by using an array value rather than a string. If you capture more than one value, providing this will increase the likelihood of a match. Check the example below:

<script>
gtag('set', 'user_data', {
"email": [yourEmailVariable1, yourEmailVariable2],
"phone_number": [yourPhoneVariable1, yourPhoneVariable2],
"address": [
{first_name: yourFirstNameVariable,last_name: yourLastNameVariable, street: yourStreetAddressVariable, city: yourCityVariable, region: yourRegionVariable, postal_code: yourPostalCodeVariable},
{first_name: yourFirstNameVariable,last_name: yourLastNameVariable, street: yourStreetAddressVariable, city: yourCityVariable2, region: yourRegionVariable2, postal_code: yourPostalCodeVariable2}
]
});
</script>

Configure your conversion page Google tag

Add “{'allow_enhanced_conversions': true}” to the config line to your Google tag that triggers across all pages.
gtag('config', 'TAG_ID', { ' allow_enhanced_conversions':true } ) ;

Before: Example of the Google tag (currently in-place):

<!-- Google tag (gtag.js) - Google Ads: 123456 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'TAG_ID');
</script>

After:

<!-- Google tag (gtag.js) - Google Ads: 123456 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config','TAG_ID', {'allow_enhanced_conversions':true});
</script>

Specify CSS selectors or Javascript variables

Before following the instructions below, make sure you’ve completed the steps in set up enhanced conversions and that you’ve selected “Google tag” as your data source. Also make sure you’ve selected “Specify CSS selectors or Javascript variables” as your implementation method.

Find enhanced conversions fields on your conversion page

  1. Using the Chrome browser in a separate tab from your Google Ads account, navigate to your conversion page. If you're unsure which page this is, you should contact your developer.
  2. Identify any customer data that's displayed on the page that you wish to send to Google. As an example, your page may display a thank you message and include a customer email address after a purchase.
    Note: At least one of the following fields must be provided for enhanced conversions to work properly:
    • Email (preferred)
    • Full name and address (first name, last name, street address, city, region, postal code, country)
    • [Optional] A phone number can also be provided along with an email or full name and address (but not by itself)
  3. Once you’ve identified the customer data on the page, you’ll now need to follow the next step to copy the CSS Selectors or Javascript variables and enter those into Google Ads.

Identify enhanced conversions CSS Selectors and input into Google Ads

  1. Follow the instructions to enable enhanced conversions and select “Specify CSS selectors or Javascript variables”.
  2. Click Customize to reveal a screen with fields where you can specify CSS selectors for each of your desired data types.
  3. Check the box for each piece of customer data you plan to implement (for example: email, name and address, and others).
  4. Select Javascript or CSS Selector.
    Note: If you’re using Javascript variables, it’s likely easiest to ask your developer which variables should be added to these fields. If you’re using CSS Selectors, you can follow the steps below.
  5. In a separate tab, navigate to your conversion page.
  6. On your conversion page, when you've found the corresponding customer data you want to send with enhanced conversions, use your mouse to right-click on top of it and select Inspect.
  7. If you're inputting the CSS selector for email in Google Ads, make sure you right click the email address displayed on your conversion page.
  8. You'll see the Chrome Developer Tools launch within your Chrome browser.
  9. Within the source code presented in the Chrome Developer Tools page, a portion of the code will be highlighted. This highlighted code is the portion which includes the CSS Selectors for the customer data you right-clicked in Step 2 of this section.
  10. Hover your mouse over the highlighted code and right-click it.
  11. Scroll down to Copy and then choose Selector.
  12. Paste that text in the corresponding fields in Google Ads (on your other tab). For reference, it should look something similar to but not exactly like this:
    tsf > div:nth-child(2) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > custEmail
  13. Complete steps 6-12 of this section for each different customer data type (email, name and address, and so on).
  14. In Google Ads, click Save.

Validate your implementation

To verify if your enhanced conversions implementation is working correctly, navigate to your conversion page (you may have to complete a test conversion to do this), and follow these steps. It’s best practice to do this immediately after implementing enhanced conversions so any changes can be made if it's not working properly.

Validate your implementation using Chrome Developer Tools

  1. Right-click on your web page.
  2. Select Inspect.
  3. Select the Network tab.
  4. Enter “google” in the search bar.
  5. Find the network request that's going to "googleadservices.com/pagead/conversion/" (or "google.com/pagead/1p-conversion/" on some browsers).
  6. Click the Payload tab to view the list of query string parameters.
  7. Look for a parameter “em” with a hashed string as the value. The value should start with “tv.1~em” followed by a long string of characters. If you see the "em" parameter, this means that the enhanced conversions tag is picking up and hashing the enhanced_conversion_data object.
Note: If you see the “em” parameter but you only see “tv.1~em” without a long hashed string following it then you’re sending the enhanced conversions parameter but it’s empty. This may happen if user-provided data isn’t available at the time of conversion.

After 72 hours, review the Diagnostics report to confirm your implementation

About 72 hours after implementing enhanced conversions, you'll be able to view the tag diagnostics report in Google Ads, which you can use to validate that your implementation is working properly. To get there:
  1. In your Google Ads account, click the Goals icon Goals Icon.
  2. Click the Conversions drop down in the section menu.
  3. Click the conversion action that has enhanced conversions enabled.
  4. Select Diagnostics from the page menu at the top. You’ll be able to see your enhanced conversions tag diagnostics report and the metrics for your enhanced conversions in each section.
  5. Review the various health checks to make sure everything is working as expected.
  6. If the tag diagnostics report notifies you that something may be wrong, follow the instructions in the notification and the Help Center to troubleshoot.

Turn off enhanced conversions

To turn off enhanced conversions at the account level, follow the steps below:

  1. In your Google Ads account, click the Goals icon Goals Icon.
  2. Click the Conversions drop down in the section menu.
  3. Click Settings.
  4. Expand the “Enhanced conversions” section.
  5. Unselect the checkbox to turn off enhanced conversions.
  6. Click Save.

To turn off enhanced conversions at the conversion action level, follow the steps below:

  1. In your Google Ads account, click the Goals icon Goals Icon.
  2. Click the Conversions drop down in the section menu.
  3. Select the conversion action you want to disable enhanced conversions for.
  4. Click Settings.
  5. Expand the “Enhanced conversions” section.
  6. Unselect the checkbox next to Enable enhanced conversions.
  7. Click Save.
Note: If you turn off your enhanced conversions you won’t be able to use them for bidding or reporting. However, turning them off will not affect your existing conversion data.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu