Set up enhanced conversions with Google tag

This article explains how to set up enhanced conversions using the Google tag. Learn more about how enhanced conversions work.

Before you begin

To use enhanced conversions, make sure you:

  • Set up Floodlight activities using Google tags.
  • 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.
  • Review 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.

Collect information with the Google tag

Identify and define your enhanced conversions fields

Ensure the fields you need like email, address, and phone number are available on the conversion page where the Floodlight 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're unsure which page this is, you should contact your developer.

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

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

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 or 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: ‘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’

First name address.first_name

User first name.

Example: 'John'

address.sha256_first_name

Hashed user first name.

Example: ‘96d9632f363564cc3032521409cf22a852f2032eec099ed5967c0d000cec607a’

Surname address.last_name

User last name.

Example: 'Doe'

address.sha256_last_name

Hashed user last name. 

Example: ‘799ef92a11af918e3fb741df42934f3b568ed2d93ac1df74f1b8d41a27932a6f’

Street address address.street

User street address.

Example: '123 New Rd'

City address.city

User city name.

Example: 'Southampton'

Region address.region

User province, state, or region.

Example: 'Hampshire'

Postal code address.postal_code

User postal code.

Example: 'SO99 9XX'

Country address.country

User country code.

Example: 'UK'

Use 2-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 (for example, where it says yourEmailVariable).

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

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.
<script>
  gtag('event', 'conversion', {
    'allow_custom_scripts': true,
    'send_to': 'DC-######/________/___________',
    'user_data': {
      'email': '[Email]',
      'phone_number': '[PhoneNumber]',
      'address': {
        'first_name': '[FirstName]',
        'last_name': '[LastName]',
        'street': '[Street]',
        'city': '[City]',
        'region': '[Region]',
        'postal_code': '[PostalCode]',
        'country': '[Country]'
      }
    }
  });
</script>

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.

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 and phone numbers would look like this:

// Implement
<script>
  gtag('event', 'conversion', {
    'allow_custom_scripts': true,
    'send_to': 'DC-######/________/___________',
    'user_data': {
"email": {{ yourEmailVariable }},
"phone_number": {{ yourPhoneVariable }}
});
</script>

Note: At least one of the following fields must be provided:
  • Email (preferred)
  • Address - For address, first name, last name, postal code, and country are required. You can optionally provide street address, city, and region as additional match keys.
  • 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 one value, providing this will increase the likelihood of a match. Check the example below:

<script>
  gtag('event', 'conversion', {
    'allow_custom_scripts': true,
    'send_to': 'DC-######/________/___________',
    'user_data': {
"email": [yourEmailVariable1, yourEmailVariable2],
"phone_number": [yourPhoneVariable1, yourPhoneVariable2],
"address": [
{first_name: yourFirstNameVariable,last_name: yourLastNameVariable, street: yourStreetAddressVariable, city: yourCityVariable, region: yourRegionVariable, postal_code: yourPostalCodeVariable},
{first_name: yourFirstNameVariable,last_name: yourLastNameVariable, street: yourStreetAddressVariable, city: yourCityVariable2, region: yourRegionVariable2, postal_code: yourPostalCodeVariable2}
]
});
</script>

Configure your conversion page Google tag

Add “{'allow_enhanced_conversions': true}” to the config line to your Google tag that triggers across all pages.
gtag('config', 'TAG_ID', { ' allow_enhanced_conversions':true } ) ;

Before: Example of the Google tag (currently in-place):

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'TAG_ID');
</script>

After:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config','TAG_ID', {'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. It’s best practice to do this immediately after implementing enhanced conversions so any changes can be made if it's not working properly.

Validate your implementation using Chrome Developer Tools

  1. Right-click on your web page.
  2. Select Inspect.
  3. Select the Network tab.
  4. Enter “google” in the search bar.
  5. Find the network request that's going to "googleadservices.com/pagead/conversion/" (or "google.com/pagead/1p-conversion/" on some browsers).
  6. Click the Payload tab to view the list of query string parameters.
  7. Look for a parameter “em” with a hashed string as the value. The value should start with “tv.1~em” followed by a long string of characters. If you see the "em" parameter, this means that the enhanced conversions tag is picking up and hashing the enhanced_conversion_data object.
Note: If you see the “em” parameter but you only see “tv.1~em” without a long hashed string following it then you’re sending the enhanced conversions parameter but it’s empty. This may happen if user-provided data isn’t available at the time of conversion

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

Search
Clear search
Close search
Google apps
Main menu