Google Ads conversion tracking

You can use Google Ads conversion tracking to track actions that people take on your website after clicking one of your ads. For example, with Google Ads conversion tracking set up, you can see which one of your Google Ads advertisements generates the most sales on your online store.

Before setting up custom Google conversion tracking through edits to the theme code or through a third-party app, make sure you don't already have conversion tracking events set up in your Google Ads account. If you're using Shopify's Google & YouTube channel, then the channel automatically adds conversion tracking events to your Google Ads account during setup.

If you set up custom tracking on top of an existing conversion tracking configuration, then your store might have duplicated conversion tracking events. Duplicated conversion tracking can cause inaccurate report data and problems with ad optimization. When you set up custom tracking, you can disable duplicated conversion tracking events from your Google Ads account.

If you need to disable duplicated conversion tracking events from your Google Ads account, then make sure you disable only the duplicated tracking events. Disabling non-duplicate conversion events can decrease ad tracking accuracy and efficiency.

Learn more about conversion settings from Google Ads Help.

Requirements

Before following this guide, you need to:

  • Have a Google Ads account
  • Be running, or planning to run, an ad through Google Ads

Setting up Google Ads conversion tracking

To set up Google Ads conversion tracking, you need to create a conversion action, install the global site tag, and then add the event snippet. If you’re tracking purchases, then you also need to edit the event snippet to adjust the value of the conversion based on the purchase amount.

Step 1: Create a conversion action in Google Ads

To set up Google Ads conversion tracking, follow the Google Ads instructions for creating a conversion action.

The most common kind of conversion action is tracking purchases. To track purchases so you can see how effective your ads are at generating sales on your online store, set the category to Purchase/Sale, and the value to Use different values for each conversion.

When you’re done creating your conversion action, click CREATE AND CONTINUE.

Step 2: Install the global site tag

After you create a conversion action, you need to install the global site tag in your Shopify theme code.

Steps:

  1. When you get to the Set up the tag step in Google Ads, click Install the tag yourself.
  2. In the Global site tag section, select the option that applies. The generated code depends on your selection.
  3. Copy your global site tag. You'll need this for the next step as well.
  4. In another browser window, open your Shopify admin and click Online Store.
  5. Click the ... button > Edit code.
  6. Open your theme.liquid file.
  7. 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. If you’re editing a global site tag that you’ve already installed, then locate the global site tag in your theme.liquid file and change the code as suggested by Google Ads.
  8. Click Save.

Step 3: Install the event snippet

After you install the global site tag, you need to add the event snippet to your checkout page. The event snippet tracks a conversion any time somebody clicks one of your ads and then later reaches the checkout page on your online store.

Steps:

  1. In Google Ads, in the Event snippet section, select Page load.
  2. Copy the event snippet code.
  3. In another browser window, open your Shopify admin and click Settings > Checkout.
  4. 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.
  5. Copy the global site tag used in the Install the global site tag step. Add this tag above the event snippet added in step 4.
  6. 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:
    1. On the line before the snippet, paste {% if first_time_accessed %}.
    2. On the line after the snippet, paste {% endif %}.
  7. The default currency is USD. If you don't sell in US dollars, then replace 'USD' in the event snippet with '{{ currency }}'.
  8. The default transaction ID is blank. To prevent Google Ads from recording duplicate conversions, next to 'transaction_id': replace '' with '{{ order_number }}'.
  9. Click Save.

After making these changes, your script should look similar to the following example:

{% 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 %}

Step 4: Make the conversion value dynamic

If the conversion action you’re tracking is purchases on your online store, then the value of each conversion is different.

For example, Andy owns an apparel store, and is running two different ads through Google Ads: one for his collection of watches, and one for his collection of T-shirts. While both ads generate a similar number of clicks and sales on his online store, the value of the purchases made by people who click the watch collection advertisement is higher. The value is higher because customers buy more expensive items after they click that ad. Andy uses this information to decide where to spend his advertising dollars.

To track a different value for each conversion, you need to edit your event snippet to use values that are specific to each transaction.

Steps:

  1. Open your Shopify admin and click Settings > Checkout.
  2. In the Additional scripts text box, find the event snippet you added in Step 3: Install the event snippet.
  3. Replace the line beginning with 'value': with one of the following snippets:
    1. To exclude taxes and shipping from the conversion amount, replace it with this snippet: 'value': {{ checkout.subtotal_price | divided_by: 100.0 }},
    2. To include taxes and shipping in the conversion amount, replace it with this snippet: 'value': {{ checkout.total_price | divided_by: 100.0 }},
  4. Click Save.

After making this change, your script should look similar to the following 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 %}

To make sure your tag is working, check the tracking status on the Conversion actions page in your Google Ads account. It might take a few hours for the conversion tracking tag to show as verified.

Setting up remarketing

Remarketing helps you target ads to people who visited your store in the past. Dynamic remarketing targets ads to your store's visitors based on the specific products they viewed on your site. You complete most of the setup for remarketing and dynamic remarketing through your Google Ads account. Read Google's setup guides for remarketing and dynamic remarketing to set up the remarketing code on Google.

You need to edit your theme code to add the remarketing code to your Shopify store. This is an unsupported theme customization, but you can try to find help in the Shopify Community forums, or hire a Shopify expert to edit your theme's code for you.

Ready to start selling with Shopify?

Try it free