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.
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
- In your Google Ads account, click the Goals icon .
- Click the Conversions drop down in the section menu.
- Click Settings.
- Expand the “Enhanced conversions” section.
- Check “Turn on enhanced conversions for web”.
- 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.
- 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.
- 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.
- 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.
- 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.
- On the tag details screen, you can decide how you’d like to capture user-provided data in your tag:
- 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”.
- 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.
- 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”.
- Click Save.
- 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.
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.
- 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:
- Use hex SHA256.
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: ‘[email protected]’ |
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. |
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).
// 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:
<script>
gtag('set', 'user_data', {
"email": {{ yourEmailVariable }},
"phone_number": {{ yourPhoneVariable }}
});
</script>
- 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:
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
'allow_enhanced_conversions': true}
” to the config line to your Google tag that triggers across all pages.Before: Example of the Google tag (currently in-place):
<script async src="https://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:
<script async src="https://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
- 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.
- 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)
- 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
- Follow the instructions to enable enhanced conversions and select “Specify CSS selectors or Javascript variables”.
- Click Customize to reveal a screen with fields where you can specify CSS selectors for each of your desired data types.
- Check the box for each piece of customer data you plan to implement (for example: email, name and address, and others).
- 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.
- In a separate tab, navigate to your conversion page.
- 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.
- 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.
- You'll see the Chrome Developer Tools launch within your Chrome browser.
- 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.
- Hover your mouse over the highlighted code and right-click it.
- Scroll down to Copy and then choose Selector.
- 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
- Complete steps 6-12 of this section for each different customer data type (email, name and address, and so on).
- 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
- Right-click on your web page.
- Select Inspect.
- Select the Network tab.
- Enter “google” in the search bar.
- Find the network request that's going to "googleadservices.com/pagead/conversion/" (or "google.com/pagead/1p-conversion/" on some browsers).
- Click the Payload tab to view the list of query string parameters.
- 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.
After 72 hours, review the Diagnostics report to confirm your implementation
- In your Google Ads account, click the Goals icon .
- Click the Conversions drop down in the section menu.
- Click the conversion action that has enhanced conversions enabled.
- 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.
- Review the various health checks to make sure everything is working as expected.
- 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:
- In your Google Ads account, click the Goals icon .
- Click the Conversions drop down in the section menu.
- Click Settings.
- Expand the “Enhanced conversions” section.
- Unselect the checkbox to turn off enhanced conversions.
- Click Save.
To turn off enhanced conversions at the conversion action level, follow the steps below:
- In your Google Ads account, click the Goals icon .
- Click the Conversions drop down in the section menu.
- Select the conversion action you want to disable enhanced conversions for.
- Click Settings.
- Expand the “Enhanced conversions” section.
- Unselect the checkbox next to Enable enhanced conversions.
- Click Save.