Enhanced conversions is a feature that aims to help improve conversion tracking accuracy. It works by recovering conversions that otherwise wouldn’t have been measured. It’s also privacy-safe since it involves the hashing of first-party customer data.
Link your Shopify store to Google Shopping to maximise your visibility.
Enhanced conversions can be turned on within your Google Ads account.
This method involves some basic coding and can be tricky, but we’ll try to keep it simple.
Follow these steps:
For this method, you must have the Global Site Tag (gtag.js) installed on your Shopify store. We recommend following Shopify’s guidance available here to install the Global Site tag onto your store.
To set up enhanced conversions, follow these steps:
{% comment %}
Analyzify - Enhanced Conversions Tag V1.3
SECTION 1: ONLY EDIT HERE
Add your relevant values here. Detailed guideline: https://analyzify.app/hub/google-ads-enhanced-conversion-setup-on-shopify/
{% endcomment %}
{% assign gads_aw_id = "AW-111111111" %}
{% assign gads_send_to = "AW-111111111/conversionlabelhere" %}
{% assign product_id = "product_id_variant-id" %}
{% assign product_id_prefix = "shopify_us_" %}
{% assign gads_merchant_id = "222222222" %}
{% assign gads_feed_country = "US" %}
{% assign gads_feed_language = "EN" %}
{% comment %}
SECTION 2: DO NOT EDIT BELOW - ONLY EDIT SECTION 1
{% endcomment %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '', { 'allow_enhanced_conversions': true });
</script>
{% if first_time_accessed %}
<!-- START Google Ads Enhanced Conversions V1.3-->
<script>
var enhanced_conversion_data = {
{% unless checkout.email == blank %}"email": "",{% endunless %}
{% unless billing_address.phone == blank %}"phone_number": "",{% endunless %}
{% unless billing_address.first_name == blank %}"first_name": "",{% endunless %}
{% unless billing_address.last_name == blank %}"last_name": "",{% endunless %}
"home_address": {
{% unless billing_address.street == blank %}"street": "",{% endunless %}
{% unless billing_address.city == blank %}"city": "",{% endunless %}
{% unless billing_address.province_code == blank %}"region": "",{% endunless %}
{% unless billing_address.zip == blank %}"postal_code": "",{% endunless %}
{% unless billing_address.country_code == blank %}"country": ""{% endunless %}
}
};
</script>
<!-- END Google Ads Enhanced Conversions V1.3-->
<!-- START Cart data V1.3-->
<script>
gtag('event', 'purchase', {
'send_to': '',
'transaction_id': '',
'value': Shopify.checkout.total_price_set.presentment_money.amount,
'currency': Shopify.checkout.total_price_set.presentment_money.currency_code,
'discount': discount(),
'aw_merchant_id': {{ gads_merchant_id }},
'aw_feed_country': '',
'aw_feed_language': '',
'items': items()
});
function discount(){
return (Shopify.checkout.discount == null) ? 0 : Shopify.checkout.discount.amount;
}
function items(){
var jsonarray = [];
for (var line_item_count = 0; line_item_count < Shopify.checkout.line_items.length; line_item_count++){
jsonarray.push({
id: {% if product_id == "product_id_variant-id" %}'' + Shopify.checkout.line_items[line_item_count].product_id + '_' + Shopify.checkout.line_items[line_item_count].variant_id{% elsif product_id == 'variant-id' %}Shopify.checkout.line_items[line_item_count].variant_id{% elsif product_id == 'sku' %}Shopify.checkout.line_items[line_item_count].sku{% endif %},
quantity: Shopify.checkout.line_items[line_item_count].quantity,
price: Shopify.checkout.line_items[line_item_count].line_price
})
}
return jsonarray;
}
</script>
<!-- END Cart data V1.3-->
{% endif %}
{% comment %}
END Analyzify - Enhanced Conversions Tag V1.3 Detailed guideline: https://analyzify.app/hub/google-ads-enhanced-conversion-setup-on-shopify/
{% endcomment %}
If you’ve followed all of these steps, enhanced conversion should be set up correctly.
This guide is informed by information from Analyzify, which built the code used above.