Google Ads Conversion Tracking in Shopify

Okay, hands up, how many of you have set up Google Ads conversion tracking in Shopify correctly? Judging from the amount of Google Ads accounts I see that use Shopify, I think I can guess it is not many of you!

So, this will be the guide for you to ensure you are tracking your conversions along with the conversion value. Firstly, it is worth mentioning that this is best done via your back-end and not through Google Tag Manager, this is because GTM does not work correctly with Shopify free version and can be tricky with the paid version. I will talk about using GTM with Shopify in another article.

Many shops I see also, have been importing their conversion data from Google Analytics, this is not recommended as the 2 platforms use different attribution models, so if you intend to use any of the Google Ads smart bidding strategies, which you should, then you need to set up Google Ads conversion tracking.

Let us get started…

Create Your Conversion Goals In Google Ads

Log in to your Google Ads account and follow these steps, Click Tools > Conversions > Add new Conversion Action via the “blue” plus button.

Then Follow these steps to set up your conversion,

  • Name: I would recommend using something like Sales or Purchases
  • Category: Purchase
  • Value: Use different values for each conversion, select the currency of the store your checkout process will use, and you can put anything in for the value as we will be tracking the value dynamically, which we will get to later
  • Count: Every
  • Click-Through Conversion Window: I would recommend selecting 30 days unless you know that the average customer journey from discovery to purchase is longer, typically for a business like a car dealership.
  • View-Through Conversion Window: 1 day
  • Include In Conversions: Yes
  • Attribution Model: Use data driven if its available to you, otherwise I would recommend using “position based” but feel free to test results with the others.
  • Click Done

You will now be given the option to see the tag set up page, as we want to place this on the Shopify backend, we want to select “Install The Tag Yourself”


Setting Up The Google Ads Tag

There are 2 parts to the tag, one is the global site tag and the other is the event snippet.

You will be presented with 3 options,

  1. The global site tag isn’t installed on all your HTML pages
  2. The global site tag is already installed on all pages, but comes from another Google product (such as Google Analytics) or from another Google Ads account
  3. The global site tag on all pages was installed already when you created another conversion action in this Google Ads account

For this guide, I will use option 1, however, do bear in mind that if you have Google Analytics already on your site you will need to select option 2 and just edit the global site tag that is already on your site.

Firstly, we want to add the global site tag to all pages of your website, here is what the global site tag would look like,

<!– Global site tag (gtag.js) – Google Ads: xxxxxxxxx –>
<script async src=””></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag(‘js’, new Date());
  gtag(‘config’, ‘AW-xxxxxxxxx);


Installing the Global Site Tag On Shopify

Now we need to log into your Shopify store admin panel and select Online Store > Themes then select Actions > Edit Code

Then as high in the <head> section as possible (first part) we want to copy and paste our global site tag here. Ensure that this is between the 2 <head> Here <head> If you already have the global site tag you just need to add a line of code, please use the 2nd option for this in the Google Ads Tag set up.

Once this is done hit Save. Now its time to set up the all-important event snippet.


Configuring the Event Snippet to Pass Conversion Values

This is the important part and this needs to be done correctly for this to work. We will need to modify the event snippet so that it dynamically passes the conversion value, it is worth noting that this will be slightly different for Shopify stores from different regions.

Here is what the standard event snippet looks like,

<!– Event snippet for Purchase conversion page –>
 gtag(‘event’, ‘conversion’, {
     ‘send_to’: ‘AW-xxxxxxxxx/uSVzCKz0xbUBELXAjM8C’,
     ‘value’: 28.95,
     ‘currency’: ‘GBP’,
     ‘transaction_id’: ”

Note, that depending on your store currency you will need to change this to the currency of your store, if you sell to multiple currencies you can use this instead,

‘currency’: ‘{{ checkout.currency }}’,

Next, we need to change the ‘value’ line so that we can send the checkout value dynamically to Google Ads. Here is what you need to change this line of code too, note, that we remove the comma here as Shopify adds a comma when values are a 1000 or more.

‘value’: {{ total_price | money_without_currency | remove: ‘,’ }},

Lastly, we need to add the transaction id or Order Number so that we do not get duplicated conversions. Here is the code for this,

‘transaction_id’: ‘{{ order.order_number }}’

You should then end up with your event snippet looking like this,

<!– Event snippet for Purchase conversion page –>
 gtag(‘event’, ‘conversion’, {
     ‘send_to’: ‘AW-xxxxxxxxx/uSVzCKz0xbUBELXAjM8C’,
     ‘value’: {{ total_price | money_without_currency | remove: ‘,’ }},
     ‘currency’: ‘{{ checkout.currency }}’,
     ‘transaction_id’: ‘{{ order.order_number }}’

That’s it, were done and ready to install this on Shopify.


Installing the Google Ads Conversion Tracking In Shopify

Log in to your Shopify store and go to settings. You then need to go to checkout and scroll down to additional scripts section.

If there is already code there, start on a new line and paste in the global site tag followed by the modified event snippet and click save!

Be sure to check that it is working as intended and troubleshoot if there are any issues.

You have now set up Google Ads Conversion tracking in Shopify and can look forward to seeing more meaningful data in your Google Ads account.