Set up enhanced conversions for leads with the Google tag

The "Linked Accounts" page under Admin Admin Icon has been moved to "Data manager" under Tools Tools Icon. Google Ads Data Manager is a data import and management tool with a point-and-click experience that lets you bring your customer data from outside of Google and activate it in Google Ads. Learn more About Data manager.
Note: The global site tag (gtag.js) is now the Google tag. With this change, new and existing gtag.js installations will get new capabilities to help you do more, improve data quality, and adopt new features – all without additional code. Learn more About the Google tag.

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.

Note: When enhanced conversions for leads are enabled, the associated Google tag will automatically capture relevant form interaction events on your website.

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 the Google tag
  2. Create a new conversion action
  3. Accept Customer data terms

1. Configure Google tag

  1. 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.
  2. Next to “Google tag configuration”, click Configure tag.
  3. In the “Your Google tag” section, ensure the Google tag is installed on your website.
  4. In the “Settings” section, click the arrow for “Automatically detect events”.
  5. In the “Configuration” section that opens, make sure “Form interactions” is toggled on, then click Save.
  6. In the “Settings” section, click the arrow for “Include user-provided data from your website”.
  7. In the “Configuration” section that opens, click “Include user-provided data from your website”.
Notes:
  • 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.
  1. In the “Google tag” menu, click Save.
  2. 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

  1. In your Google Ads account, click the Goals icon Goals Icon.
  2. Click the Conversions drop down in the section menu.
  3. Click Summary.
  4. Click New conversion action.
  5. Select Import in the "New conversion action” page.
  6. Select CRMs, files, or other data sources and then Track conversions from clicks.
  7. In the “Data Source” section, select Connect a new data source.
    1. You can choose to connect data sources via:
      1. Direct connection
      2. Third-party integration by Zapier
  8. Click Continue.
  9. Enter the settings for this conversion action. For details on the settings, check out Set up offline conversion imports
  10. 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.

  11. Click Done.
  12. 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:

  1. Next to “Customer data terms”, select View Terms and review the “Policies and Additional Terms for Customer Data”.
  2. Click the “I have read and accept the terms on behalf of my company” checkbox.
  3. Click Agree. You’ll notice your status is updated to “Accepted”.
Note: These terms apply to your entire account or manager account. If you're not able to view the terms, your account conversions are tracked by a manager account. The customer data terms must be accepted from the manager's account and any Google Ads manager account uploading on behalf of the manager account using cross-account tracking.

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

  1. Using the Chrome browser in a separate tab from your Google Ads account, navigate to your lead form submission page.
  2. 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
  3. 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

  1. 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.
  2. You'll notice the Chrome Developer Tools launch within your Chrome browser.
  3. 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.
  4. Hover your mouse over the highlighted code and right-click it.
  5. Scroll down to “Copy” and then choose Selector.
  6. 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
  7. Complete steps 2-6 of this section for each different customer data type (email or phone)
  8. 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:

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’

Note: You’ll need to make sure the customer data is available when the custom code fires. If the user information is collected on a previous page or iframe, you’ll need to make sure it’s available in a variable to your code when it's called.

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)

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

// 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>

Related links

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
8476177066335299905
true
Search Help Center
true
true
true
true
true
73067
false
false
false