This article explains how to set up enhanced conversions manually using Google Tag Manager and addresses common issues with validation and implementation.
Enhanced conversions is a feature that can improve the accuracy of your conversion measurement, and it can be set up with minor or no changes to your tagging configuration. It supplements your existing conversion tags by sending hashed, first-party conversion data from your website in a privacy-safe way. The feature uses SHA256, a secure, one-way hashing algorithm on your first-party customer data, such as email addresses, before sending it to Google. The hashed data is then matched with signed-in Google accounts to attribute your campaign conversions to ad events, such as clicks or views.
Learn more about how enhanced conversions work.
Before you begin
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 (see below).
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.
Instructions
- Sign in to Campaign Manager 360.
- Navigate to the relevant advertiser.
- Open the Floodlight Configuration section.
- Under “Enhanced conversions”, click the checkbox below the compliance statement.
- By turning on enhanced conversions, you confirm you’ve reviewed the terms of service for enhanced conversions in Floodlight and accept them on behalf of the Company.
- Click Save.
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:
- Using “Manual Configuration” with CSS Selectors or existing data layer variables. No code changes are required on your page. (Recommended if Automatic 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.
- 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.
- 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
- 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
- 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.
- Sign in to your Google Tag Manager account.
- Click Workspace, then click Tags from the navigation menu.
- Select the Floodlight tracking tag you’d like to implement enhanced conversions with and edit that tag.
- Click Include user-provided data from your website.
- In the "Select user-provided data variable" dropdown, click New Variable.
- 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.
- 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.
- On the “Variable Configuration” screen, select Choose Variable Type to begin setup.
- On the “Choose Variable Type” screen, select DOM Element, and in the dropdown on the “Variable Configuration” screen, change “Selection Method” to “CSS Selector”.
- Give your variable a title.
- 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
- Navigate back to your conversion page tab (but don’t close Google Tag Manager).
- 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.
- 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.
- Hover your cursor over the highlighted code and right-click..
- Scroll down to Copy, then choose Copy Selector.
- 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
- The text will look something like this:
- Click Save.
- Repeat steps 2–8 of this section for each different piece of customer data (for example, email, name and address, etc.), by copying the CSS Selector into a new variable for each customer data variable in Google Tag Manager.
- In Google Tag Manager, click Save.
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.
Enable enhanced conversions in Google Tag Manager and create custom Javascript variable
- Sign in to your Google Tag Manager account.
- Click Workspace, then click Tags from the navigation menu.
- 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.
- Click Include user-provided data from your website.
- Click Select user-provided data variable, then select New Variable.
- In the new “User Provided data variable”, select Code at the bottom.
- Under “Choose Variable Type,” select Custom Javascript.
- 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
}
}
}
- 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
}
}
- For example, a website that only collects emails and phone numbers would create a custom javascript variable that looks like this:
- As a reminder, at least one of the following fields must be provided:
- 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 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 experiencing issues with your enhanced conversions implementation.