Set up enhanced conversions manually with Google Tag Manager

This article explains how to set up enhanced conversions manually using Google Tag Manager and addresses common issues with validation and implementation. Learn more about how enhanced conversions work.

Before you begin

Conversions measured by importing Google Analytics goals are not supported for enhanced conversions.

Make sure you have Floodlight Tracking set up using Google Tag Manager.

  • Know the conversion page URL where the conversion tag fires (for example, the confirmation page URL) and the conversion event trigger (such as a button click or a page view).
  • Ensure first-party customer data (email, full name and home address, and/or phone number) is available on the page where your conversion tracking tag fires.
  • As this process requires knowledge of how conversion tracking is set up on your website and some code changes, make sure you are able to speak with your development team as needed.
  • Ensure you’ve reviewed Google’s customer data policies and agree to the enhanced conversion terms of service and policies in your Campaign Manager 360 account. Learn more about allowing enhanced conversions in Campaign Manager 360.

Before accepting the terms of service, make sure you already have a conversion tracking tag set up in the Google Tag Manager container you plan to use for enhanced conversions. Otherwise your container may not properly be enabled for enhanced conversions.

Set up enhanced conversions manually using Google Tag Manager

If you currently use Google Tag Manager for conversion tracking, you can implement enhanced conversions with slight changes to your configuration.

There are 3 primary ways in which you can implement enhanced conversions in Google Tag Manager:

  1. Using “Manual Configuration” with CSS Selectors or existing data layer variables. No code changes are required on your page. (Recommended if the "automatic" option isn't available.)
    • This is the easiest way to implement enhanced conversions with Google Tag Manager, as it usually requires no code changes on your page as long as you have customer data (such as an email) available on your conversion page.
    • If you frequently change your website code, particularly the formatting or CSS selectors on your conversion page, you may want to consider using data layer variables or the “Code” option (see below) instead, as changing your website formatting could disrupt the CSS Selector method.
  2. Using the “Code” method to send all data in a single data object (this may require code changes on your page).
    • You can implement enhanced conversions as a single data object using JavaScript variables on your conversion page as long as the customer data (emails, phone numbers, etc.) you would like to pass in the enhanced conversions tag is defined in global JavaScript variables on your conversion page.
    • This method is useful if you prefer to pass the information using JavaScript variables, or if the customer data isn't available on the conversion page (for example, it’s available on previous pages and needs to be passed to the conversions page). It is also preferable if you frequently change the formatting on your website, as it’s more resilient to code changes.
  3. Using automatic collection (if available).
    • Google recommends using one of the manual options above for the best results, but the automatic option is quick and simple if you’re unable to use one of the manual implementation paths.

Find enhanced conversions variables on your conversion page

  1. Using the Chrome browser, navigate to your conversion page.
    • The conversion page is where the conversion you’re trying to measure with enhanced conversions (for example, purchases from Page A) is being tracked using your existing conversion tracking tag. If you are unsure which page this is, contact your developer and identify any customer data that is displayed on the page that you wish to send to Google (for example, your page may display a “thank you” message and include a customer email address after a purchase).
    • At least one of the following fields will need to be provided for enhanced conversions to work properly:
      • Email (preferred)
      • Address (first name, last name, postal code, and country are required if you choose to use this data)
      • (Optional) A phone number can also be provided along with an email or a full name and address, but not by itself
  2. Once you have identified the customer data on the page, you’ll need to copy the CSS Selectors and enter them into Google Tag Manager (or utilize existing data layer variables if they already exist). This ensures your enhanced conversion tag knows which pieces of data to hash and send to Google. It’s important to keep the conversion page tab open.

Enable enhanced conversions in Google Tag Manager

In a separate tab, open Google Tag Manager.

  1. Sign in to your Google Tag Manager account.
  2. Click Workspace, then click Tags from the navigation menu.
  3. Select the Floodlight tracking tag you’d like to implement enhanced conversions with and edit that tag.
  4. Click Include user-provided data from your website.
  5. In the "Select user-provided data variable" dropdown, click New Variable.
  6. Select “Manual configuration (recommended)”.
    • You may also select “Code” if you would like to use Custom JavaScript or other data objects to send your data through Google Tag Manager. This method requires data to be formatted in a particular way, so if you’d like to do this, see the “Code” instructions below. You’ll see “User provided data” at the top of the page, followed by all the pieces of customer data you can include as part of your enhanced conversion tag.
  7. For the relevant user data field you want to provide via enhanced conversions, click the dropdown and select “New Variable”.
    • If you already have unhashed variables in your data layer (whether using CSS selectors or other variable types), you can select them instead of creating new variables. If you aren’t sure, continue through the instructions.
  8. On the “Variable Configuration” screen, select “Choose Variable Type” to begin setup.
  9. On the “Choose Variable Type” screen, select “DOM Element”, and in the dropdown on the “Variable Configuration” screen, change “Selection Method” to “CSS Selector”.
  10. Give your variable a title.
  11. Enter the CSS selector that references your users’ data into the “Element selector” input field (see below on how to find the CSS Selector). You can leave the “Attribute name” field blank (more on this below).

Next, you’ll learn how to copy the CSS Selectors from your conversion page and paste them into the enhanced conversions variables, so it’s important you keep this page tab open.

Identify enhanced conversions CSS Selectors and input into Google Tag Manager

Follow these instructions to identify the CSS Selectors to input into the enhanced conversion tag fields (email, phone, etc.).
If you already have unhashed variables in your data layer, you can select them instead of creating new CSS variables. If you aren’t sure, follow the instructions below.
  1. Navigate back to your conversion page tab (but don’t close Google Tag Manager).
  2. Right-click the corresponding customer data you want to send with enhanced conversions and select “Inspect” to launch Chrome Developer Tools in your Chrome browser.
    • For example, if you are trying to capture an email address, right-click the email address displayed on your conversion page.
  3. In the source code in the Chrome Developer Tools page, a portion of the code will be highlighted. This code is the page element where you need to extract CSS Selectors for the customer data you right-clicked.
  4. Hover your cursor over the highlighted code and right-click..
  5. Scroll down to Copy, then choose “Copy Selector”.
  6. Paste the text in the “Element selector” field in Google Tag Manager.
    • The text will look something like this: tsf > div:nth-child(2) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > custEmail
  7. Click Save.

Repeat steps 2–8 for each piece of customer data (email, name and address, etc.).

Set up enhanced conversions using “Code” in Google Tag Manager

Identify and define your enhanced conversions variables

First, ensure the variables you need (such as email, address, and phone number) are available on the conversion page where the Floodlight conversion tag fires. This will likely be the case on conversion pages for purchases, sign-ups, and other similar conversion types that require customer data. If you are unsure, contact your developer.

Once it’s confirmed the customer data is available, you’ll need to store it on your page as global JavaScript variables so they can be used by the enhanced conversions tag (which is addressed in the next section).

At least one of the following fields must be provided:

  • Email (preferred)
  • Address (first name, last name, ZIP/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

The following table includes more information about the customer data variables you can define. You can name the variables whatever you’d like. The “Key Name” column indicates how the variables will be referenced in the enhanced conversions tag. Note that all data should be passed as String type variables, and when defining name and address, define each component as an individual variable (first name, last name, etc.).

Data Field Key Name (in custom JavaScript variable below) 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 the country code
First name address.first_name User first name. Example: “John”
Last name address.last_name User last name. Example: “Doe”
Street address address.street User street address. Example: “123 Main St”
City address.city User city name. Example: “San Francisco”
Region address.region User province, state, or region. Example: “California” or “CA”
Postal code address.postal_code User postal code (5-digit version only). Example: “12345”
Country address.country User country code. Example: “US”. Use two-letter country codes per ISO 3166-1 alpha-2 standards

You’ll enable enhanced conversions in Google Tag Manager and reference the customer data variables you have created in the following steps.

Keep the names of your customer data variables handy, as you’ll need them in future steps.

Enable enhanced conversions in Google Tag Manager and create a custom JavaScript variable

  1. Sign in to your Google Tag Manager account.
  2. Click Workspace, then click Tags from the navigation menu.
  3. Select the Floodlight conversion tracking tag you’d like to implement enhanced conversions with and edit that tag.
    • If you haven’t set up your Floodlight conversion tracking tag in your Google Tag Manager account, read Google’s Floodlight guide.
  4. Click Include user-provided data from your website.
  5. Click Select user-provided data variable, then select New Variable.
  6. In the new “User Provided data variable”, select Code at the bottom.
  7. Under “Choose Variable Type,” select Custom JavaScript.
  8. Copy the following code into the custom JavaScript variable:

function () {
return {
"email": yourEmailVariable , // replace yourEmailVariable with variable name that captures your user’s email
"phone_number": yourPhoneVariable , // repeat for yourPhoneVariable and following variable names below
"address": {
"first_name": yourFirstNameVariable
"last_name": yourLastNameVariable ,
"street": yourStreetAddressVariable ,
"city": yourCityVariable ,
"region": yourRegionVariable ,
"postal_code": yourPostalCodeVariable ,
"country": yourCountryVariable
}
}
}

  1. For each type of customer data in the code above, replace the placeholder variables (for example, yourEmailVariable) with the name of the global JavaScript variable containing that piece of customer data on your conversion page.
    • As a reminder, at least one of the following fields must be provided:
      • Email (preferred)
      • Address (first name, last name, postal code, country are required)
      • Phone number (must be provided in addition to one of the other two pieces of information above)
    • If your site doesn't collect one of those fields, remove the field entirely rather than leaving it blank.
      • For example, a website that only collects emails and phone numbers would create a custom JavaScript variable that looks like this:
        function () {
        return {
        "email": yourEmailVariable ,
        "phone_number": yourPhoneVariable
        }
        }
  2. Click Save.

Enhanced conversions are now set up for that conversion action. The next step is to validate that it’s working properly. Go to the Validate your implementation section below.

Validate your implementation

To validate that your enhanced conversions implementation is working as intended, you should use the Google Tag Manager preview and debug mode to verify your enhanced conversions. First, enable preview and debug mode and navigate to your conversion page. In Google Tag Manager, click on your floodlight tag, then click the "Variables" tab. You can see the data being sent in the Enhanced Conversions object. If you don’t see the enhanced conversions object, or if the object is empty, it means there is an error in your implementation. Please review the implementation instructions to ensure you’ve implemented enhanced conversions correctly.

Common issues

If you're 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 experiencing issues with your enhanced conversions implementation.

Multiple tags are detected

Choose one of the tags listed in the dialog box. If you have Google tag and Google Tag Manager, the “Google tag” is recommended.

Enhanced conversions data isn't available at the time of conversion

In some cases, enhanced conversions data may not be available at the time of conversion, such as when that information is collected on another domain (for example, paying through a third-party domain), or if it is collected elsewhere in the conversion flow (for example, signed-in customers may not re-enter their first-party information, or it may be collected on the previous page).

Variables weren't successfully implemented for enhanced conversions

For Google Tag Manager users, review the steps above related to creating variables properly to ensure you did so correctly. Also ensure that the variables are the ones referred to when configuring enhanced conversions in Google Tag Manager and that they are populated with data by the time of conversion.

Code-copying errors

Double-check that all enhanced conversions code on your page and/or variable names entered into Google Tag Manager are correct. If you implemented enhanced conversions using JavaScript variables, ensure the custom JavaScript snippet was copied correctly and updated to reflect your variable names (not placeholder information). If you used CSS Selectors, ensure you selected the correct Selector and properly copied the selector information as described in the steps above.

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

Search
Clear search
Close search
Google apps
Main menu