Set up enhanced conversions with the global site tag (beta)

Enhanced conversions 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.

You can set up enhanced conversions with minor changes, or no changes to your tagging configuration, in one of two ways: using Google Tag Manager or the global site tag. This article will explain how you can set up enhanced conversions if you are currently using global site tag and explains common issues with validation and implementation. 

If you would like to implement enhanced conversions with Google Tag Manager, read set up enhanced conversions with Google Tag Manager.

Before you begin

 
Note: Conversions measured by importing Google Analytics goals are not supported for enhanced conversions. If you would like to use enhanced conversions, consider setting up a new Google Ads conversion action with a global site tag or Google Tag Manager.
  • Know the conversion page URL where the conversion tag fires (e.g. the confirmation page URL) and the conversion event trigger (for example, a button click or a page view).
  • Make sure there is first party customer data available (email, full name and home address, and/or phone number) on the page where your conversion tracking tag fires. 
  • This implementation requires knowledge of how conversion tracking is set up on your website and some code changes, so make sure you are able to speak with your development team as needed.
  • Please ensure that you have reviewed and confirmed that you can comply with the enhanced conversion customer data policies in Google Ads.

Instructions

  1. Sign in to your Google Ads account.
  2. In the upper right corner of your account, click the tools icon , and under "Measurement," click Conversions.
  3. Select the conversion action you want to measure with enhanced conversions.
  4. Click Settings on the page menu on the left.
  5. Open the “Customer data terms” drop-down and review the terms and policies that apply to enhanced conversions  
    1. If you don't see “Customer data terms,” contact your Google representative, to make sure you're on the customer allowlist.
  6. Click Save.
  7. In the page menu on the left, click Conversion actions to go back to the page where your conversion actions are listed.
  8. Select the conversion action you wish to use for enhanced conversions.
  9. Open the “Enhanced conversions” section. 
  10. There are two ways to implement enhanced conversions:
    • Automatic enhanced conversions: You can implement automatic enhanced conversions without making any additional changes to the conversion tracking code already on your page. 
      1. This is the easiest implementation method as long as you already have your conversion tracking tags set up on your conversion page and have customer data available (e.g. email, address, etc.). If you frequently change your website code, in particular the formatting/CSS Selectors on your conversion page, you may want to consider manual enhanced conversions, as changing your website formatting could disrupt automatic enhanced conversions.
    • Manual enhanced conversions: You can implement manual enhanced conversions with your developer if you have customer data stored in global javascript variables and are able to add those variables to the conversion tracking code already on your page. 
      1. This method is useful if you prefer to pass the information using javascript variables or if the customer data is not available on the conversion page (e.g. it is available on previous pages and needs to be passed to the conversions page). It is als preferable if you frequently change the formatting on your website, as it’s more resilient to code changes. 
  11. Click Save.

Set up enhanced conversion using automatic enhanced conversion with your global site tag

Find enhanced conversions variables on your conversion page

  1. Using the Chrome browser navigate to your conversion page. If you are unsure which page this is, you should contact your developer. 

Identify any customer data that is 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 variables 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 - all are required if you choose to use this data)
  • [Optional] A phone number can also be provided along with an email, or full name and address (but not by itself)
  1. Once you have identified the customer data on the page, you will now need to follow the next step to copy the CSS Selectors and enter those into Google Ads so your automatic enhanced conversions knows which pieces of data to hash and send to Google. It’s important you keep this conversion page tab open.

Identify enhanced conversions CSS Selectors and input into Google Ads

First you’ll want to open your Google Ads account to the automatic enhanced conversions page (in one tab):

  1. Sign in to your Google Ads account.
  2. In the upper right corner of your account, click the tools icon , and under "Measurement," click Conversions.
  3. Select the conversion action you want to measure with enhanced conversions, and then expand the “Enhanced conversions” section.
  4. You’ll see “automatic enhanced conversions” selected (if you do not, you should select that.)
  5. Check the box for each piece of customer data you plan to implement (e.g. email, name and address, etc.)
  6. Click CSS Selector.
 

To identify the CSS Selectors to input into those fields, follow these steps:

 
  1. In another tab, navigate to your conversion page.
  2. On your conversion page, when you have found the corresponding customer data you want to send with automatic enhanced conversions, use your mouse to right-click on top of it and select Inspect.
    1. If you are inputting the CSS selector for email in Google Ads, make sure you right click the email address displayed on your conversion page.
  3. You will see the Chrome Developer Tools launch within your Chrome browser
  4. Within the source code presented in the Chrome Developer Tools page, you will see a portion of the code 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.
  5. Hover your mouse over the highlighted code and right-click it
  6. Scroll down to Copy and then choose Selector
  7. Paste that text in the Google Ads automatic enhanced conversions section (on your other tab) in the corresponding field
    1. 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
  8. Complete steps 2-7 of this section for each different customer data type (e.g. email, name and address, etc.)
  9. In Google Ads, click Save
 

Automatic enhanced conversions is now set up. The next step is to validate that it’s working properly. Skip to the “Validate your implementation” section below. 

Set up enhanced conversions using manual enhanced conversions with your global site tag 

If you currently have conversion tracking implemented using Google’s global site tag directly on your page (not within a third-party tool or iFrame), you can implement enhanced conversions by making slight changes to your global site tag. 

Identify and define your enhanced conversions variables

Ensure the variables 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 are unsure which page this is, you should contact your developer.

Once you’ve confirmed that the information is available, you’ll need to validate that the variables on this page are stored as global javascript variables so they can be used by the enhanced conversions snippet  

Note: At least one of the following variables must be provided:

  • Email (preferred)
  • Full name and address (first name, last name, street address, city, region, postal code, country all required)
  • A phone number can also be provided along with an email, or full name and address.

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

Data Field Key Name Description
Email address                      email User email.
Phone number phone_number User phone number. The tag will remove symbols and dashes, but the number must contain country code.
First name first_name User first name. Example: “John”
Last name last_name User last name. Example: “Doe”
Street address home_address.street User street address. Example: “123 Main St”
City home_address.city User city name. Example: “San Francisco”
Region home_address.region User province, state, or region. Example: “California” or “CA”
Postal code home_address.postal_code User post code (5-digit version only). Example: “12345”
Country home_address.country User country code. Example: “US”. Use two-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 (e.g. where it says yourEmailVariable)

// Implement
<script>
  var enhanced_conversion_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 are not hashed.

    "phone_number": yourPhoneVariable,
    "first_name": yourFirstNameVariable,
    "last_name": yourLastNameVariable,
    "home_address": {
      "street": yourStreetAddressVariable,
      "city": yourCityVariable,
      "region": yourRegionVariable,
      "postal_code": yourPostalCodeVariable,
      "country": yourCountryVariable
    }
  };
</script>
  • The conversion tracking tag will perform basic normalization on the data you provide so you shouldn’t need to re-format your data. For phone numbers, the tag will remove symbols and dashes, but the number should contain country code so that it can be formatted into E.164 standard.
  • If your site does not 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>
  var enhanced_conversion_data = {
 "email": {{ yourEmailVariable }},
 "phone_number": {{ yourPhoneVariable }}
     };
</script>

Note: At least one of the following variables must be provided:

  • Email (preferred)
  • Full name and Address - For address, all data fields must be provided (first name, last name, street address, city, region, postal code, country)
  • 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 1 value, providing this will increase the likelihood of a match. See the example below:

<script>
  var enhanced_conversion_data = {
    "email": [yourEmailVariable1, yourEmailVariable2],
    "phone_number": [yourPhoneVariable1, yourEmailVariable2],
    "address": [
      {street: yourEmailVariable, city: yourCityVariable, region: yourRegionVariable, postal_code: yourPostalCodeVariable},
      {street: yourEmailVariable1, city: yourCityVariable2, region: yourRegionVariable2, postal_code: yourPostalCodeVariable2}
    ]    
  };
</script>
Configure your conversion page global site tag
  • Add “{'allow_enhanced_conversions': true}” to the config line to your global site tag that triggers across all pages. 
gtag('config', 'AW-CONVERSION_ID', ' allow_enhanced_conversions' : true ) ;
 
  • Before: Example of the Global Site tag (currently in-place):
<!-- Global site tag (gtag.js) - Google Ads: 123456 -->
<script async        src="https://www.googletagmanager.com/gtag/js?id=AW-123456"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
   gtag('js', new Date());
   gtag('config', 'AW-123456');
           </script>
  • After
<!-- Global site tag (gtag.js) - Google Ads: 123456 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-123456"></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
   gtag('js', new Date());
   gtag('config', 'AW-123456'), ' allow_enhanced_conversions' : true ) ;
          </script>

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.

Validate your implementation using Chrome Developer Tools

  1. Right click on your web page.
  2. Select Inspect.
  3. Select the Network tab.
  4. Enter your conversion ID or conversion label into the search bar.
  5. Find the network request that is going to googleadservices.com/pagead/conversion/ (or google.com/pagead/1p-conversion/ on some browsers)
  6. In the Headers part of the Network request, scroll to “Query String Parameters”. Here, you should find that there is a parameter “em” with a hashed string as the value. If you see the ‘em’ parameter, this means that the enhanced conversions tag is correctly picking up and hashing the enhanced_conversion_data object.

 

Common Issues

If you are unable to validate your enhanced conversions implementation, you should go back through the setup instructions to ensure that all necessary steps were followed. If you’re still having trouble, below is a list of common reasons why you may be encountering issues with your enhanced conversions implementation.

Enhanced conversions data is not available at the time of conversion

Enhanced conversions data may not be available at the time of conversion, like when that information is collected on another domain (e.g. paying through a third-party domain) or if it is collected elsewhere in the conversion flow (e.g. signed-in customers may not reenter their first-party information, or it may be collected on the previous page).

Pre-hashed data is being provided in your enhanced conversions

We use the SHA256 algorithm to hash the first party data you provide, which is the industry standard for one-way hashing of data. At this time, enhanced conversions does not support pre-hashed data.

The enhanced conversions parameter (allow_enhanced_conversions) is not configured to be true within the global site tag 

If enhanced conversions is not declared in the tag configuration as true, then the implementation will not work. Review the Configure your conversion page global site tag step above for more information. 

Variables were not successfully implemented for enhanced conversions

For global site tag users make sure that you have passed the necessary first-party data into global javascript variables on the page where the conversion tag is firing. It may be necessary to retrieve information entered from a previous page.

Code snippet copying errors

Make sure when implementing the enhanced conversions code that it was copied correctly and then updated to reflect your variable names (and not placeholder information).
Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue