Enhanced Conversions for Google Ads
Enhanced conversions is an advanced tracking feature for Google Ads that allows you to send hashed customer data to Google in a privacy safe way. Using enhanced conversions can improve the accuracy of your conversion tracking and help attribute conversions to your advertising campaigns more effectively.
Enhanced conversions supplement your existing Google Ads conversion tracking by sending hashed first-party customer data (such as email address) to Google when a conversion occurs. The data is hashed using a secure, one-way SHA256 algorithm before it is sent, so Google only receives anonymised information. Google uses this information to match conversions to users who are signed into Google, which can help improve conversion attribution.
When a visitor completes a purchase on your website, the enhanced conversions script collects specified customer data from the order (for example, the shipping email address), applies the required formatting and hashing, and sends it to Google using the Google tag. ShopWired does not store or process the hashed data itself; the script only sends it to Google for conversion attribution.
Important notes:
- Enhanced conversions support privacy requirements by ensuring customer data is not sent in plain text
- ShopWired supports sending enhanced conversions data to Google Ads using the Conversion tracking scripts setting on the Visitor monitoring page
- Enhanced conversions is not supported when importing conversions from Google Analytics goals
- You must use a Google Ads conversion action
- Enhanced conversions data is only sent on the
checkout/complete
page when the conversion event fires
Enabling enhanced conversions in Google Ads
Enabling enhanced conversions in Google Ads
- Sign in to your Google Ads account
- Select the
Goals
icon - Select the
Conversions
drop down from the section menu - Select
Settings
- Expand the Enhanced conversions section
- Select
Turn on enhanced conversions for web
- Review and accept the compliance statement to confirm you will comply with Google’s policies
- Select
Google tag
as the setup method - Select
Save
to apply the changes
Adding the enhanced conversions script to ShopWired
Adding the enhanced conversions script to ShopWired
To implement enhanced conversions, you must add two scripts to your website:
- The standard Google tag (gtag.js)
- The enhanced conversions JavaScript
Adding the standard Google tag
- Obtain your Google Ads conversion ID and label from your Google Ads account
- Navigate to Settings > Visitor monitoring
- Paste the following code into the Conversion tracking scripts setting, replacing
AW-XXXXX
andAW-XXXXX/XXXXX
with your own details:
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-XXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-XXXXX');
function trackPurchase () {
gtag('event', 'conversion', {
'send_to': 'AW-XXXXX/XXXXX',
'value': order.total,
'currency': 'GBP',
'transaction_id': order.reference
});
}
</script>
Adding the enhanced conversions script
Immediately below the standard Google tag, add the following script to hash and send customer data (for example, the shipping email address) to Google:
<script>
(function() {
const encodeSha256 = (function() {
let sha256Queue = [],
processQueue = () => (sha256Queue || []).forEach(f => f());
return function (string = "") {
return new Promise(resolve => {
if(crypto?.subtle?.digest) {
let text_encoder = new TextEncoder('utf-8'),
encoded_text = text_encoder.encode(string),
hashing_task = crypto.subtle.digest('sha-256', encoded_text);
hashing_task.then(data => {
let decoded_array = Array.from(new Uint8Array(data)),
converted_string = decoded_array.map(byte => (byte.toString(16).padStart(2, "0"))).join('');
resolve(converted_string);
});
} else {
let hash_resolution = () => {
let hash = sha256.create().update(string);
resolve(hash.hex());
};
if(!window.sha256 && !sha256Queue.length) {
let sha_256_script = document.createElement('script');
sha_256_script.src = '//cdn.jsdelivr.net/npm/js-sha256@0.11.0/src/sha256.min.js';
document.body.appendChild(sha_256_script);
sha_256_script.onload = processQueue;
}
if(window.sha256) hash_resolution();
else sha256Queue.push(hash_resolution);
}
});
}
})();
$(() => {
let data_to_process = [
{
"name": "sha256_email_address",
"value": "{{ order.shipping_email|lower|trim|e('js') }}",
"hash": true
}
],
data = data_to_process.reduce((data, field) => {
if(field.hash) {
data.queued_tasks = [
...data.queued_tasks,
encodeSha256(field.value).then(hashed_value => data.user_data[field.name] = hashed_value)
];
} else {
data.user_data[field.name] = field.value;
}
return data;
}, {
"queued_tasks": [],
"user_data": {}
});
Promise.all(data.queued_tasks).then(() => {
gtag('set', 'user_data', data.user_data);
trackPurchase();
});
});
})();
</script>
- This script:
- Extracts and hashes the customer’s email address using SHA256
- Sends the hashed value to Google with the conversion event
- Ensures the conversion event only fires after the hash completes
Required customer data fields
Required customer data fields
Google requires that at least one of the following fields is provided for enhanced conversions:
- Email address (preferred)
- Name and address (first name, last name, postal code, and country are required)
- Phone number (must be provided in addition to email or full name/address)
All fields must be normalised and hashed using SHA256 before being sent to Google. The example above shows how to provide the hashed email address.
Testing and validating your implementation
Testing and validating your implementation
After setting up enhanced conversions:
- Complete a test purchase on your website
- Use Chrome Developer Tools to check that the enhanced conversions script runs and sends data to Google
- After 72 hours, review the Diagnostics report in your Google Ads account to confirm that enhanced conversions are working
- Approximately 30 days after implementation, review the impact of enhanced conversions in your Google Ads reporting