Just follow the steps carefully and have your Google Ads Enhanced Conversion working on your Shopify store.
You all probably have received emails from Google Ads saying you can now set up your Enhanced Conversions. But let’s be honest, it wasn’t quite possible to set it up on Shopify when it was first launched. We tried to make it work for a long and tried all the possible methods – and we finally have a fully working solution that we are happy to share.
This is a free and fully functional tutorial, so you will not have to purchase Analyzify or another app. Follow the steps carefully and have your Google Ads Enhanced Conversion working on your Shopify store.
Things change quite fast in the data analytics world – especially for Shopify merchants. And I know it is quite too hard to catch up! Make sure to subscribe to Analyzify Hub, where we share tutorials and best practices.
Note: This tutorial was updated on March 2022 with the most up-to-date information and code blocks.
Are you using an ad blocker? The tutorial contains many images- most image names include “Google Ads” or “Ads”. Ad blockers think that it is an ad and blocks those. So make sure to temporarily disable your ad blocker to properly view the content.
It works quite similarly to Facebook Conversion API. It’s a feature that allows you to share more data about your conversions with Google Ads so that the conversion tracking will work better.
As an example, on regular Google Ads conversion tracking; the order ID, revenue, and optionally purchased products are being sent. With Google Ads Enhanced Conversion – you can also send customer details such as email, name, address, and phone number. The data is being sent as encrypted as Google explains:
The feature uses a secure one-way hashing algorithm called SHA256 on your first party customer data, such as email addresses, before sending to Google. The hashed data is then matched with signed-in Google accounts in order to attribute your campaign conversions to ad events, such as clicks or views. Source
Conversion tracking has become significantly hard after the new changes in the world of data tracking such as iOS 14.5, Safari ITP, and with arise of adblockers. You can’t optimize and measure your advertising spending if you don’t measure them well. So, the answer is yes if you want to count and attribute more conversions.
As usual, there are several methods. You can easily do it yourself using the first method. You can choose the 2nd, Google Tag Manager method, if you want a more sophisticated setup. We only covered the Purchase tracking as it is the only place where the related user data (email, phone, address) is available.
You can create or apply a new conversion to your existing one. In this tutorial, I will use an existing Google Ads conversion. However, it will very similar if you want to make a new conversion as well.
Step 1: Go to Google Ads > Tools & Settings > Measurement – Conversions
Step 2: Find your Purchase conversion. The conversion source should be “Website”.
You can not apply Enhanced Conversions into a Google Analytics or GA4-sourced conversion.
Step 3: You should be seeing the “Enhanced Conversions” section right below “Tag setup”.
If you are not seeing that, it means this feature is not available for your Ads account yet.
Click the checkbox. Now we will need to choose our setup method.
I will now share the steps and code blocks you need. You can check this official article if you are not using Shopify or if you want to learn more about it.
To be able to move on with me here, you should have the Global Site Tag (gtag.js) installed on your store. You will need to type your URL and click CHECK URL. If Global Site Tag is not installed on your store, you will only be shown the Google Tag Manager Option. If that’s the case, move to Method 2. Alternatively, you can learn how to install Global Site Tag on Shopify.
As mentioned above, if you have the Global Site Tag installed, you should be seeing something like the one below. Follow the steps:
Choose Global Site Tag > Edit Code > Use Event Snippet – and SAVE.
We will also need to learn your Conversion ID and label. Just scroll up to the “Tag Setup” part and choose Google Tag Manager. We will NOT use Google Tag Manager. We are choosing this just to get your Conversion ID and Label easier. Copy your Google Ads Conversion ID and Label and move to the next step.
Better safe than sorry! Let’s take the backup of your existing codes – just in case.
Go to your Shopify Store Admin > Settings > Checkout > Additional Scripts
Things are quite sensitive here. Copy all of the existing code blocks and save them somewhere safe; you can email yourself 🙂
Take a sip from your coffee. Now the fun part begins! We will add & remove some codes from your Shopify Checkout scripts.
You most probably have a conversion script there. If you can’t see it in the first place, you can try searching “AW-” – and the search should lead you. It should look like this:
If you don’t have it there, there are two possibilities:
a) Your conversion tracking wasn’t already working properly.
In this case, just continue to the next step because our code snippet will already include the conversion tracking script as well.
b) You are using Google Tag Manager to track conversions.
In this case, you can either pause your conversion tag in Google Tag Manager or use the 2nd Method to implement the Enhanced Conversions.
The code block is below. Please read these points carefully before you implement them:
Agreed? Great! Now copy the code block below and go to the next step.
{% 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', '{{ gads_aw_id }}', { '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": "{{ checkout.email }}",{% endunless %}
{% unless billing_address.phone == blank %}"phone_number": "{{ billing_address.phone }}",{% endunless %}
{% unless billing_address.first_name == blank %}"first_name": "{{ billing_address.first_name }}",{% endunless %}
{% unless billing_address.last_name == blank %}"last_name": "{{ billing_address.last_name }}",{% endunless %}
"home_address": {
{% unless billing_address.street == blank %}"street": "{{ billing_address.street }}",{% endunless %}
{% unless billing_address.city == blank %}"city": "{{ billing_address.city }}",{% endunless %}
{% unless billing_address.province_code == blank %}"region": "{{ billing_address.province_code }}",{% endunless %}
{% unless billing_address.zip == blank %}"postal_code": "{{ billing_address.zip }}",{% endunless %}
{% unless billing_address.country_code == blank %}"country": "{{ billing_address.country_code }}"{% endunless %}
}
};
</script>
<!-- END Google Ads Enhanced Conversions V1.3-->
<!-- START Cart data V1.3-->
<script>
gtag('event', 'purchase', {
'send_to': '{{ gads_send_to }}',
'transaction_id': '{{ order.order_number }}',
'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': '{{ gads_feed_country }}',
'aw_feed_language': '{{ gads_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" %}'{{ product_id_prefix }}' + 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 %}
Once again, ONLY copy; don’t paste it yet.
Before you move on, we have an important note. We keep updating these code blocks with the latest information. Please make sure to visit the related page on our website to make sure that you have the latest code.
The following section of the code is to be updated with your own values/information. DO NOT change any other section in the code.
{% 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" %}
And here are the details:
Let’s quickly double-check your Google Feed product ID format.
Visit Google Ads and click PRODUCTS on the left menu. You will see the merchant ID as marked below – and your product ID format next to that. On our example it starts with “shopify_AU_…” because the native Google Sales Channel is used for product feed on Shopify.
If you are using a different format here, you should adjust our codes accordingly. As an example, if you are only seeing your variant ID instead of Shopify’s classic format – then just update our related lines to these ones:
{% assign product_id = "variant-id" %}
{% assign product_id_prefix = "" %}
All the other fields are quite easy. Don’t forget to replace:
After you replace all these values – now it is time to use this code.
Visit Shopify Admin > Settings > Additional Scripts
And paste the final code there. It should look like this:
We are done. The enhanced conversion data should be coming into Google Ads shortly. As mentioned above:
This is a new feature, and it is still in “beta”. Even though we tested very well and observed great results, it might not perform perfectly for your case.
We are done! If you are curious, here is the reference from Shopify documentation.
This is a more complex setup and it requires your store to have a set of data layers and a correctly structured Google Tag Manager container to make it work. We will add a separate series of tutorials for this.
For now, we recommend you use the method explained above. If you still want to use Google Tag Manager;
Final Words
Google Ads Enhanced Conversions feature is quite new and still in beta. You might not receive a huge spike in your conversion reports. We always recommend adopting these changes as early as possible. There is no harm in that.
Thanks for reading our tutorial. Make sure to subscribe to Analyzify Hub, where we share tutorials and best practices.
You can also leave your questions as comments, and we will do our best to get back to you! Also, feel free to share your comments, appreciations, frustrations, or any other feelings 🙂