Google Ads conversion tracking

You can use Google Ads conversion tracking to track actions that people take on your website after clicking on 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.

If you're using the Google Shopping app in Shopify, then make sure not to duplicate conversion tracking for your store.The Google Shopping app automatically adds conversion tracking events to your Google Ads account when you set it up. If you set up custom Google conversion tracking through edits to the theme code or through a third-party app, 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. 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.
  4. In another browser window, open your Shopify admin and click Online Store.
  5. Click Actions > 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:
    Conversion tracking step 2b
    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 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.
  5. 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 %}.
  6. The default currency is USD. If you don't sell in US dollars, then replace 'USD' in the event snippet with '{{ shop.currency }}'.
  7. The default transaction ID is blank. To prevent Google Ads from recording duplicate conversions, next to 'transaction_id': replace '' with '{{ order_number }}':

    Google Ads conversion tracking event snippet configured

  8. Click Save.

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 on 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 Order processing section, 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 | money_without_currency }},
      
    2. To include taxes and shipping in the conversion amount, replace it with this snippet:
          'value': {{ checkout.total_price | money_without_currency }},
      

    After you replace the line, your script looks similar to the following example:

    Google Ads event snippet configured

  4. Click Save.

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.

Set 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.

Steps:

  1. Sign in to Ads.
  2. Click Campaigns.
  3. Click Create your first campaign.
  4. Click the Shared Library option on the left hand sidebar.
  5. In the Audiences section, click View.
  6. Click the Set up remarketing button. You receive a block of code.
  7. Enter your email address to receive the code by email.
  8. When you receive the code, copy it.

  1. Click theme.liquid to open it in the editor.
  2. Paste the code you received from Google on a blank line above the </body> HTML tag:

    Bottom of theme.liquid template

  3. Click Save. If you use a Shopify theme other than Narrative, then you are done. If you use Narrative, then complete the next step.

  4. If you use the Narrative theme, then you need to add some CSS to prevent the Google remarketing code from affecting the formatting of your website:

    1. In the Assets folder, click theme.scss.liquid.
    2. At the bottom of the file, paste the following code:

       iframe[name="google_conversion_frame"] {
         display:none;
       }
    3. Click Save.

Ready to start selling with Shopify?

Try it free