Home > Shopify Tutorials > Set up & install Google AdWords conversion tracking on Shopify

How to set up and install Google AdWords conversion tracking on Shopify

Last updated: September 01, 2024
Written and researched by experts at AvadaLearn more about our methodology

By Sam Nguyen

CEO Avada Commerce

If you are starting up a new online business, there will be a great number of moving parts. To make the products or develop your service, you will spend a lot of time taking photos, writing descriptions, setting up the technical stuff, and figuring out how to drive customers through developing a marketing plan. And for eCommerce businesses on Shopify, running ads can provide you exposure similar to a storefront, and it is getting more complex every day.

So, in this How to set up and install Google AdWords conversion tracking on Shopify article today, I will explain and instruct you how to set up Adwords conversion tracking and add Google Adwords conversion tracking tag to your website. Before you begin, ensure that you have followed the instructions to set up conversion tracking for your website.

How to set up Adwords conversion tracking on Shopify

Of course, before you start anything on this guide, you need to have a Google Ads account. And of course, you are also the one who is running or planning to run an ad through Google Ads. While setting up Google Ads conversion tracking, the task that you have to take care of is to generate a conversion action, get the global site tag installed, and then insert the event snippet. In case you are tracking purchases, you also have to adjust the event snippet to edit the value of the conversion depends on the purchase amount.

Set up Adwords conversion tracking on Shopify before you add
Set up Adwords conversion tracking on Shopify before you add

Step 1: Generate a conversion action in Google Ads

The first step in setting up Google Ads conversion tracking is to follow the Google Ads instructions to generate a conversion action. Tracking purchases is the most popular type of conversion action, which helps you see how productive your ads are at creating sales on your online store and setting the category to Purchase/Sale, and the value to Use different values for each conversion. After you have completed generating your conversion action, just hit a click on Create and continue.

Step 2: Get the global site tag installed

When you have done generating a conversion action, the next step is to get the global site tag installed in your Shopify theme code.

  • Firstly, navigate to the Set up the tag section in Google Ads, and click Install the tag yourself after that.
  • Next, when you are in the Global site tag section, choose the option that applies, and you will have the generated code based on your selection.
  • You will see your global site tag and copy it after that.
  • Then, open another browser window and you will have to see your Shopify admin and click Online Store.
  • Hit a click Actions > Edit code.
  • Choose to open your theme.liquid file.
  • In case you haven’t installed a global site tag before, you should paste the copied global site tag between the <head> and </head> tags to apply the tag to every page in your store. In case you are adjusting a global site tag that you have installed before, the location that you should put the global site tag in is your theme.liquid file to get the code changed suggested by Google Ads.
Conversion tracking example for the first time you've installed a global site tag
Conversion tracking example for the first time you've installed a global site tag
  • Finally, click the Save button.

Step 3: Install the event snippet

Have you finished íntalling the global site tag? The next step is to add the event snippet to your checkout page. Whenever somebody clicks one of your ads, the event snippet will track conversion and then reach your online store’s checkout page later on. You should follow:

  • Select Pageload in the Event snippet section of Google Ads.
  • Next, copy the event snippet code.
  • From another browser window, choose to open your Shopify admin and click Settings > Checkout.
  • When you open the Order processing section, you will need to paste the event sippet in the Additional scripts text box. In case you have had the code in your Additional scripts text box, just choose to insert the event snippet on a new line under the existing code.
  • Google Ads may record a duplicate conversion in case the customer reloads the checkout page. To prevent this duplicate conversion, you need to add tags before and after the event snippet so it can not trigger once per customer. To be more specific:
    • Paste {% if first_time_accessed %} on the line before the snippet.
    • Paste {% endif %} on the line after the snippet.
  • USD is the default currency on Shopify. In case you don’t sell in US dollars, simply replace ‘USD’ in the event snippet with '{{ currency }}'.
  • The default transaction ID is set in the blank. If you want to prevent Google Ads from recording duplicate conversions, you must have the 'transaction_id': replaced '' with '{{ order_number }}':
{% if first_time_accessed %}
  <!-- Event snippet for Test conversion page -->
  <script>
    gtag('event', 'conversion', {
      'send_to': '1234567',
      'value': 1.0,
      'currency': '{{ currency }}',
      'transaction_id': '{{ order_number }}',
    });
  </script>
  {% endif %}
  • Don’t forget to click Save at the end!

Step 4: Make the conversion value active

Depending on the conversion action that you are tracking on your online store, you will have different values of each conversion. For instance, when Ted has an apparel store, and he is running two different ads via Google Ads. Specifically, one is for his collection of watches, and one is for his collection of pants. He has both ads created the same number of clicks and sales on his online store, and he will have a higher value of the purchases made by people who click on the watch collection advertisement. The value is higher as the customers purchase more expensive products after they click that ad. This information is used by Ted to decide where to spend his advertising dollars.

In order to track a different value for each conversion, you will need to adjust your event snippet to utilize values that are detailed to each transaction. You should follow the steps below:

  • Open your Shopify admin and choose Settings and then Checkout.
  • Navigate to the Order processing section, and you will have to find the event snippet you added in Step 3 from the Additional scripts text box.
  • Find and replace the line beginning with 'value': with one of the snippets below:
    • If you want to exclude taxes and shipping from the conversion amount, replace it with this snippet: 'value': 0.0,
    • If you want to include taxes and shipping in the conversion amount, just replace it with this snippet: 'value': 0.0,
Edit your event snippet to make the conversion value active
Edit your event snippet to make the conversion value active

When you have done replacing the line, your script looks like to this example:

{% if first_time_accessed %}
<!-- Event snippet for Test conversion page -->
<script>
  gtag('event', 'conversion', {
    'send_to': '1234567',
    'value': {{ checkout.subtotal_price | divided_by: 100.0 }},
    'currency': '{{ currency }}',
    'transaction_id': '{{ order_number }}',
  });
</script>
{% endif %}
  • Click Save.

NOTE: During the process, you must ensure your tag is working, and you can check the tracking status on the Conversion actions page from your Google Ads account. You might need several hours to have the conversion tracking tag to display as verified.

How to add Google AdWords conversion tracking on Shopify

Step 1. Navigate to your Shopify Admin Panel

First of all, access to your Shopify Admin Panel before you start.

Step 2. Click on Checkout

Next, you will see the gear icon representing Settings, click it, and choose Checkout.

Choose Checkout from your Shopify Admin Panel
Choose Checkout from your Shopify Admin Panel

Step 3. Complete the code

When you have done logging in to your Google Ads account, and hit a click on the 3dot menu in the corner in the top right and choose Conversions under the Measurement column. Then, you should choose the big blue plus sign and choose your website as your tracking template. Next, you should complete the guidelines below:

  • Conversion name (type down any name)
  • Category (Purchase or Sale)
  • Value (Utilize different values for each conversion)
  • The rest can be set as default.

The next step is to click on Create and continue. On the whole, there will be two sections that you need to complete. Choose the download snippet button for both the Global site tag and Event snippet.

After that, heading back to your Shopify account and scroll down and find the Additional scripts section in Order Processing and paste the code in the available field, which lies at the bottom of this page.

Paste the code in the available Additional scripts field
Paste the code in the available Additional scripts field

The example below is the script that was used for Global site tag:

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

  gtag('config', 'xx-123456789123');
</script>

Next, we must paste the event snippet and make sure you edit the code before we do this. Also, you should replace the 'send_to': 'xx-123456789123/lkadsjKDweLK45W' line from your downloaded code snippet with the code example below:

In case the prices that you are using are 2,000.00:

{% if first_time_accessed %}
<script>
  gtag('event', 'conversion', {
      'send_to': 'xx-123456789123/lkadsjKDweLK45W',
      'value': {{ total_price | money_without_currency | remove:',' }},
      'currency': '{{ shop.currency }}',
      'transaction_id': '{{ order.order_number }}'
  });
</script>
{% endif %}

In case the prices that you are using are 2.000,00 in Europe currency:

{% if first_time_accessed %}
<script>
  gtag('event', 'conversion', {
      'send_to': 'xx-123456789123/lkadsjKDweLK45W',
      'value': {{ checkout.total_price | money_without_currency | remove:'.' | replace: ',', '.' }},
      'currency': '{{ shop.currency }}',
      'transaction_id': '{{ order.order_number }}'
  });
</script>
{% endif %}
  • NOTE: When things are done, it’s always best to make a test payment to check whether the conversion tracking is precisely installed.

Conclusion

Overall, when you generate conversion action in your Google Ads account, you might need to get a conversion tracking tag to embed it to your website. This tag will track when there is someone clicked your ad goes to your website and finishes an action that you have defined as valuable, like making a purchase or sign-up the information. In terms of advertising on Shopify, the Google Ads conversion tracking is available for you to track actions taken by people on your website after hitting a click on one of your ads.

Hopefully, this post gives you something useful that you can apply to get success in business. If we miss something or that you don’t understand about Shopify Adwords conversion tracking, don’t hesitate to leave us a comment in the section below. Share it with your friends and follow our site for more interesting articles.

Do we miss anything? Do you want to add any tips or knowledge? Please be free to leave a comment in the section below and we will reply to you soon. Thank you!


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.