2021 Winner - Inc. Best Workplace & Company On The Rise

To set up conversion tracking in Shopify, the following tags are required.

  1. The Global Site Tag
  2. An Event Snippet

If you have not yet set up a conversion in Google Ads yet, please visit How to Create a New Conversion in Google Ads, for the instructions on how to add a conversion.

If you already have a conversion setup in Google Ads that you would like to track, you can follow the instructions below:

  1. Sign into Google Ads
  2. In the upper right corner, click the tools icon , and under “Measurement,” click Conversions.
  3. Select the conversion you would like to track.
  4. Below “Settings” there is an option for “Tag Setup”. Expand that window.

5. Under “Tag setup” select “Install the tag yourself”
6. Under “Global site tag”;

a. If this is the first Google Ads conversion being setup in Shopify, you will select “The global site tag isn’t installed on all your HTML pages”

b. If this is not the first Google Ads conversion being setup in Shopify, you will select “The global site tag on all pages was installed already when you created another conversion” and continue to Step 14

7. Copy your “Global site tag”. *Note* the account number below should be different for your tag.

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

8. In another browser window, open your Shopify admin and click “Online Store”.
9. Click Actions > Edit code.
10. Open your theme.liquid file.

a. If this is the first time you’ve installed a global site tag, then paste the copied global site tag between the <head> and </head> tags to apply the tag to every page in your store:

11. Open your checkout.liquid file.

a. If this is the first time you’ve installed a global site tag, then paste the copied global site tag between the <head> and </head> tags to apply the tag to every page in your checkout:

12. Go back to “Tag setup” in Google Ads
13. Under “Tag setup” select “Install the tag yourself”
14. Under “Event Snippet” select “Page Load”
15. Copy your “Event snippet”. *Note* the account number below should be different for your tag.

<!-- Event snippet for Transaction conversion page -->
<script>
  gtag('event', 'conversion', {
      'send_to': 'AW-1010101010/xxxxxx_xxxxxxxxxxxx',
      'value': 1.0,
      'currency': 'USD',
      'transaction_id': ''
  });
</script>

16. In another browser window, open your Shopify admin and click Settings > Checkout.
17. In the Order processing section, in the Additional scripts text box, paste the event snippet. If you already have code in the Additional scripts text box, then add the event snippet on a new line below the existing code.
18. If a customer reloads the checkout page, then Google Ads might record a duplicate conversion. To prevent duplicate conversions, add tags before and after the event snippet so that it triggers once per customer:

a. On the line before the snippet, paste:

{% if first_time_accessed %}

b. On the line after the snippet, paste:

{% endif %}

19. The default currency is USD. If you don’t sell in US dollars or want to match the currency with your Shopify site, replace ‘USD’ in the event snippet with '{{ currency }}'
20. The default transaction ID is blank. To prevent Google Ads from recording duplicate conversions, next to ‘transaction_id’: replace ” with '{{ order_number }}
21. In order to make your conversion value dynamic, replace the line beginning with ‘value’: with one of the following snippets:

a. To exclude taxes and shipping from the conversion amount, replace it with this snippet:

'value': {{ checkout.subtotal_price | money_without_currency }},

b. To include taxes and shipping in the conversion amount, replace it with this snippet:

'value': {{ checkout.total_price | money_without_currency }},

22. Your new “Event Snippet” should look like the screenshot below
{% if first_time_accessed %}
<!-- Event snippet for Transaction conversion page -->
<script>
  gtag('event', 'conversion', {
      'send_to': 'AW-1010101010/xxxxxx_xxxxxxxxxxxx',
      'value': {{ checkout.subtotal_price | money_without_currency }},
      'currency': '{{ shop.currency }}',
      'transaction_id': '{{ order_number  }}'
  });
</script>
{% endif %} 

23. Click save!
Ricky Weiss
Latest posts by Ricky Weiss (see all)