Enhanced conversions for leads uses first-party user-provided data from your website to measure sales and transactions that happen off your website. If you run lead-generation campaigns to drive offline sales, enhanced conversions for leads can help you understand the impact of your ad spend.
Enhanced conversions for leads relies on a tag to capture first party data to enable durable, more accurate, and higher quality measurement. With enhanced conversions for leads, you can upload deeper lead data back into Google in a durable way, to further drive reporting and optimization insights.
This article explains how to use the Google tag to set up enhanced conversions for leads measurement on your website using the Google tag. If you use Google Tag Manager, view set up enhanced conversions for leads using Google Tag Manager. If you want to learn more about the benefits of enhanced conversions for leads and how they work, check out About enhanced conversions.
Before you begin
Before setting up enhanced conversions for leads, you’ll need to identify your website lead forms and pick a field from the form that uniquely identifies your leads. At least one of the following variables must be provided when you configure enhanced conversions for leads on your website and when you later import the conversions:
- Email (preferred)
- A phone number
We recommend using the lead's email address because it’s a highly unique identifier and isn’t prone to being reformatted in your CRM. If you're using a phone number, the tag will remove symbols and dashes, but the number must contain a country code.
You'll also need to:
- Note the URL where the lead form on your website is located. You may need this information during setup.
- Make sure that auto-tagging is enabled. Auto-tagging is necessary to import offline conversions.
- Make sure that there is first-party customer data available (email and/or phone number) on your website lead form.
- Ensure that you have reviewed and confirmed that you can comply with the customer data policies in Google Ads (view steps on this below).
Instructions
Here's an overview of the steps for setting up offline conversion imports using enhanced conversions for leads:
1. Configure Google tag
- Select how you want to set up your provided data. You can select either “Google Tag” or “Google Tag Manager” before clicking Continue with Google click identifiers.
- Google tag: If your provided data is off, you’ll receive an error message and direction to configure your tag. If your tag is configured correctly, you’ll receive a success message.
- Google tag manager: You’ll receive a notification with links to instructions and the Google Tag Manager page.
- Next to “Google tag configuration”, click Configure tag.
- In the “Your Google tag” section, ensure the Google tag is installed on your website.
- In the “Settings” section, click the arrow for “Automatically detect events”.
- In the “Configuration” section that opens, make sure “Form interactions” is toggled on, then click Save.
- In the “Settings” section, click the arrow for “Include user-provided data from your website”.
- In the “Configuration” section that opens, click “Include user-provided data from your website”.
- Select how you’d like to include user-provided data:
- Automatic collection. This automatically inspects the page for strings that match a pattern for email addresses. You can also click the “Exclude some CSS selectors from automatic collection” checkbox to limit automatic collection to certain pages, forms or parts of your site.
- Manual configuration. Specify CSS selectors or JavaScript variables on your page.
- Image code. Add JavaScript code to your website that sends an event.
- Click Save.
- Select how you’d like to include user-provided data:
- If your transactions are related to sensitive categories, you should use manual configuration to ensure that sensitive data isn’t shared with Google.
- To measure website leads that convert offline, your tag can include user-provided data with lead form events to simplify the import process. Configure how the user-provided data is included. Google is committed to protecting the confidentiality and security of the data you share with us. Learn more about Customer data policies.
- In the “Google tag” menu, click Save.
- You’ll receive a success notification. Click OK.
Next, you’ll need to Import conversions from ad clicks into Google Ads.
2. Create a new conversion action
- In your Google Ads account, click the Goals icon .
- Click the Conversions drop down in the section menu.
- Click Summary.
- Click New conversion action.
- Select Import in the "New conversion action” page.
- Select CRMs, files, or other data sources and then Track conversions from clicks.
- In the “Data Source” section, select Connect a new data source.
- You can choose to connect data sources via:
- Direct connection
- Third-party integration by Zapier
- You can choose to connect data sources via:
- Click Continue.
- Enter the settings for this conversion action. For details on the settings, check out Set up offline conversion imports.
- Click Save and continue. The next page will confirm your new conversion action.
Note: If you initially skipped connecting data sources, click Set up in the “Set up data sources” section.
- Click Done.
- Check the box to Turn on enhanced conversions for leads. If you don’t want enhanced conversion for leads, you can click Continue with Google click identifiers or Finish setup later. If you’d like to turn it on after you’ve set up your conversion action, you can Click Summary. In the enhanced conversions for leads drop down, check the box to Turn on enhanced conversions for leads
3. Accept Customer data terms
If you haven’t yet accepted the Customer data terms, you can review and accept them by following these instructions:
- Next to “Customer data terms”, select View Terms and review the “Policies and Additional Terms for Customer Data”.
- Click the “I have read and accept the terms on behalf of my company” checkbox.
- Click Agree. You’ll notice your status is updated to “Accepted”.
Set up enhanced conversions for leads using Javascript or CSS selectors
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.
Find enhanced conversions fields on your lead form page
- Using the Chrome browser in a separate tab from your Google Ads account, navigate to your lead form submission page.
- Identify the fields where customer data is entered on the page that you wish to send to Google.
Note: At least one of the following fields must be provided for enhanced conversions to work properly:
- An email (preferred)
- A phone number
- Once you’ve identified the customer data fields on the page, you’ll need to follow the next step to copy the CSS Selectors and enter those into Google Ads.
Identify enhanced conversions CSS Selectors and input into Google Ads
- On your lead form page, when you've found the corresponding customer data you want to send, use your mouse to right-click on top of it and select Inspect.
Note: If you're inputting the CSS selector for email in Google Ads, make sure you right-click the email address displayed on your lead form page.
- You'll notice 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 Google Ads automatic enhanced conversions section (on your other tab) in the corresponding field.
- 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
- For reference, it should look something similar to but not exactly like this:
- Complete steps 2-6 of this section for each different customer data type (email or phone)
- In your Google Ads account, click Save.
Note: It is a best practice to use the ID attribute to retrieve the value from a DOM element. IDs are unique and less likely to change over time than other properties, such as class names or names. They also aren’t affected by layout changes, which means that your code will still work even if the layout of your page changes.
If a field doesn’t already have an ID, you can add one by using the id
attribute in the HTML. For example:
<input type="text" id="myTextField">
Set up enhanced conversions for leads by editing your website code
You can implement enhanced conversions for leads with custom Javascript code to call the Google tag directly (forms hosted by a third-party tool or iFrame may require this) instead of automatic detection or through selectors.
Identify and define your enhanced conversions fields
Ensure your email or phone number are available to your custom code. 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 and 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’ |
Implement the enhanced conversions script
Configure and add the following script to where you want the Google tag to fire. Ensure 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 the user-provided data object
<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,
***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.
});
</script>
// Send the user-provided data using the following code snippet
<script>
gtag('event', 'form_submit', {'send_to': 'AW-ID'});
***Keep AW-
as is and change ID
to your Google tag ID
</script>
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 would look like this:
// Implement
<script>
gtag('set', 'user_data', {
"email": {{ yourEmailVariable }}
});
</script>
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]
});
</script>
Example code for providing pre-hashed user data would look like this:
// Implement
<script>
gtag('set', 'user_data', {
"sha256_email_address": {{ yourEmailVariable }},
"sha256_phone_number": {{ yourPhoneVariable }}
});
</script>