How to Setup Google Ads Conversion Tracking in Shopify

Having done over one hundred audits of Google Ad accounts for Shopify businesses, I am dumbfounded at the number of accounts that don’t have conversion tracking accurately setup. Some stores spend thousands each month with no idea what, if any part of the campaigns, generate sales. Other businesses may track a sale as one conversion, but they have no revenue data—the sale of a $10 product looks the same as a $1000 product. If your return on ad spend (ROAS) goal is 500%, you have to know what searches, ads, products, and audiences succeed or fail at bringing in $5 for every $1 of spend.

Previously known as Google AdWords, Google Ads has two ways to setup conversion tracking in Shopify.

Option 1: If you accurately track sales in Google Analytics, the quickest solution is to import your transactions as a conversion goal. See the steps to import transactions from analytics to Google Ads.

Option 2: This tutorial covers why you need to edit the existing Google Ads conversion code and how to do it for the best data. I use this solution to help Shopify stores grow.

I recommend the second option because my testing has repeatedly shown sales through Google Ads are lost to the (direct)/(none) traffic source in Google Analytics due to cross-domain tracking limitations of payment processors. This means your advertising would lack the proper attribution it deserves for generating sales, which ruins your ability to optimise ad campaigns. For one of my Google Ads clients I was able to attribute more than double the sales of Google Ads with the conversion tracking code compared to analytics. That level of data accuracy can be the difference between the death of an ecommerce business and it thriving.

You will learn how to setup Shopify with gtag.js tracking for Google Ads. One benefit of gtag.js, released at the end of 2017, is its simplicity. The second benefit is its increased accuracy over the older ga() functions to combat intelligent tracking prevention in Safari. Here we go.

1. Create your conversion in Google Ads

1. In your Google Ads account from the top-right, click the spanner icon. Under the “Measurement” column, go to “Conversions”:

2. Create a new conversion. Click “Website”.

Use the following settings for your conversion:

Name: The name can be anything. I recommend you make it “Sales”

Category: “Purchase/Sale”

Value: “Use different values for each conversion” and select the currency used in your Shopify store. It is okay if this currency is different to your ad account as Google will do the currency conversion. You could enter your average order value (AOV) taken from Google Analytics as the default value. Your average order value can be gather from the “Conversions” > “Ecommerce” > “Overview” section. However, as you’ll see, this value is never empty because we’ll replace this with a liquid variable that contains the order amount in dollars.

Count: “Every”.

Conversion windows: “30 days”. If your products cost more than $200 or you know customers take weeks to research a product before buying, extend the value to “90 days”.

View-through conversion window: “1 day”.

Include in “Conversions”: Tick this option. The setting lets you decide if these conversions should be included in your “Conversions” and “Conversion value” columns

Attribution: “Linear”. Let’s say a person clicks one ad then returns to Google for another search. They then click another ad and buy. The first ad should receive recognition for the sale so you can more accurately optimise campaigns with this data. The linear model means each ad and search term will get 0.5 of a conversion. If you used the last-click option, the first ad would get 0 and the second ad would get 1 conversion. Never use the last-click option because it ignores the effect of upper funnel ads. We will geek out on the various models soon. Linear is a good default.

4. Click “The global site tag isn’t installed on all your HTML pages” option for the global site tag.

5. Click the “Page load” option for the event tag.

We will need to modify the event tag then add the global tag and the modified event tag to your Shopify store to complete setup. But first, I want to educate you about attribution.

Picking the Perfect Attribution Model

If someone clicked on you Google Shopping ad, looked at a product but didn’t buy, then returned to the site organically and purchased, would you attribute 100% of that purchase to organic sales? Would you consider the role Google Shopping had played when working out the ROI on each platform?

Attribution modelling in Google Ads and Analytics is a set of rules that determines how each transaction or conversion is credited. Within Analytics, the last-click model (most commonly used by novices to measure sales and goal completions) attributes 100% of the sale to the last action associated with how the user accessed the site such as organic, paid search, or other channel. The first click does the opposite which grants 100% to the first interaction. Realistically, ecommerce stores often see a journey with a variety of interactions before a user becomes a customer. This is why you must consider what model is best.

There are a number of attribution models available to use.

Linear: I recommend this model when you first set up your attribution modelling. It attributes the sale evenly across all touchpoints or interactions the customer has had throughout their buying cycle. This will help you understand how each platform in your multi-channel marketing strategy has benefited your revenue. For example, if the customer originally came to the site through a Facebook product ad, came back again through Google Shopping, then came back via a search ad and eventually came to the site organically, the linear attribution model will award 25% of the sale to each platform.

First click: This model awards 100% of the conversion or sale to the first interaction or touch-point the customer had. It is useful to identify how your customers are finding you, but the model disregards later touch-points the visitor has with your business. You will not know what led to the sale when there is more than one click.

Last click: The opposite of first click attribution—it attributes 100% of the sale to the last interaction had by the customer. It is badly favoured by many online retailers. Given businesses get customers on many marketing platforms, it’s vital to know the influence each platform has had on the sale. Last click doesn’t give you this information.

Position-based: This is a mixture of all of the above but with the majority of the conversion (about 80%) split between the first and last click. The remaining 20% is attributed to the middle of the funnel. This can work for many ecommerce retailers. Those with more expensive items may find the middle touch-points are not attributed enough as larger items are usually a longer consideration process for the customer.

Time decay: The most complex model of all of them. Time decay puts the most emphasis on the the last click, however it attributes a percentage to other touch-points in the journey. The touch-points furthest away from the sale get the least attribution, building up to the most attribution at the final touch-point. This model is worth considering if your customers take a longish time-to-purchase.

Data-driven: An automated attribution method that uses real historical data. Google will look at many data points to build your own attribution model. You may not have this model available as it initially requires 600 conversions through a single conversion action over 30 days. Use it when you meet the requirements. You can learn more about data-driven attribution.

For further help with selecting the best attribution model when your campaigns progress, refer to the Model Comparison Tool. You will be able to test the affect different models have on your data.

Do not add this to your Shopify store. You will need to make alterations so the order value and order ID is passed to Google. When optimising your campaign, you want to improve it based on the generated revenue, not just “this campaign got 10 sales versus the other with 12 sales”.

1. Replace the line:

'value': ,

…with:

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

This parses the value of the purchase with shipping and other taxes like GST.

Some stores use a comma separated currency in “General” > “Settings” with the code {{amount_with_comma_separator}}. This means the value variable will have a comma, which does not work with Google Ads. If your store formats its currency with a comma often seen in European currencies, steps one and two need to be modified with the replace filter like {{ checkout.total_price | money_without_currency | replace: ',', '.' }}. If the store uses Norwegian Krone that has a comma for decimals and separates three digits with a full stop (like 1.000,00), use this filter | remove: '.' | replace: ',', '.'

2. While you can get away with the first two steps, I recommend you use the transaction_id parameter to prevent duplicate conversions when customers visit the thank you page a second time.

Replace the line:

'transaction_id': ''

…with:

'transaction_id': '{{ order.order_number }}'

3. Update the currency code to the store’s currency. While you may have set this when configuring the code in Google Ads, I suggest using Shopify’s liquid variable shop.currency in case the store’s currency changes and you forget to update the conversion code. The output value is a three-letter format that meets Google’s formatting.

Replace the line:

'currency': 'AUD',

…with:

'currency': '{{ shop.currency }}',

4. For whatever reason, implementing transaction_id does not always stop duplicate conversion data. I’ve seen it happen repeatedly for my Google Ads clients. I recommend you wrap the entire tracking code in the following liquid, which runs scripts only on their first time of the order status page: {% if first_time_accessed %}...{% endif %}

If you want to exclude taxes and shipping, replace “checkout.total_price” with “checkout.subtotal_price”:

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

3. Adding the Google Ads Conversion Code to Shopify

Use the full global site tag given to you in Google Ads. You will install the Google Ads global site tag only on the thank you page inside the “if statement” so it runs when an order is placed.

1. Log into the admin section of your Shopify store. Go to “Settings” > “Checkout”. Under the field “Additional scripts”, paste your Global site tag and the updated Google Ads conversion code inside the conditional tag. All this code should look like:

You can immediately test the tracking works by viewing the thank you page for an order then search the source code for the snippet to confirm the values inserted for the order ID and conversion value are what you want. If you’re using {% if first_time_accessed %} around your tracking, temporarily remove that so you can view the order status of an existing order.

For other debugging, go to the conversions section in Google Ads, click on the conversion, then click on “Webpages” from the top to view what pages are triggering the conversion.

Alternative: Google Ads with Google Analytics Global Site Tag

The Google Analytics setup inside Shopify’s settings uses Google’s universal analytics. It does not use the global site tag. You can copy-and-paste the global site tag snippet into Shopify’s analytics setup, but Shopify simply extracts the tracking ID rather than use gtag.js.

This solution combines the Google Ads conversion tracking with the Google Analytics global site tag. It stops duplicate page view data when the store uses Shopify’s settings for Google Analytics. You would use this solution if you wanted to send other data in gtag.js like dynamic remarketing or an event via gtag.js.

3. In the Shopify admin, go to “Settings” > “Checkout”. Under the field “Additional scripts”, paste your Global site tag and the updated Google Ads conversion code inside the conditional tag. The Google Ads conversion tag remains the same as the previous solution. All this code should look like:

Alternative: Google Analytics Import

The above method will work with everyone. However, there is another way that requires Google Analytics. I use the Google Analytics method after running the conversion code method above then seeing it is less accurate than the sales from google / cpc in Google Analytics.

If you see the google / cpc channel has less sales data than Google Analytics, pause your original goal then import the transaction goal into your Google Ads. Go through my Google Analytics setup for Shopify to get clean data in Analytics.

1. Create a new conversion. Click “Import”.

2. Select the type “Transaction” from the primary view you use in Google Analytics that has the most complete and accurate data.

3. Click “Import and Continue”.

4. Once you’ve created the goal, click on it to edit it. The only value I suggest you change is the attribution model from “Last Click” to “Linear”. Your settings will look like:

You are done importing transaction data from Google Analytics into Ads.

Joshua Uebergang is founder and Head of Strategy at Digital Darts. He helps Shopify stores get more of the right visitors and convert them into sales. At 6'9", yes, he plays basketball. Get extra tips and tricks from him to build your ecommerce store by entering your email below.

Thanks for your article, it’s been really helpful 🙂
Just one issue I’m experiencing: conversions are being tracked by Adwords like twice the real amount… I have set the “{% if first_time_accessed %} -tracking code- {% endif %}” tags to avoid the code running again when the user comes back to visit the status page, but even doing that the issue persists… Do you know what could be wrong? We can’t take the information Adwords give us seriously to take campaigns decisions, it’s a real problem. Thanks for your help!

Mine is set up right according to your instructions, but no conversion data is being shown in Adwords (and there should be.) Initially, conversions were being attributed to “referral traffic” so I added the “checkout.shopify”, paypal, and my own domain, to the “referral exclusions list”, however still no conversions are being attributed to Adwords. I went back through my GA Import steps and all are set up as you outline. One note, I decided to change from “last click” to “first click” attribution just in case something about the click attribution is throwing off the tracking. Any thoughts?

I recommend last-click attribution for most campaigns. Changing of this setting should only be done for marketing goals rather than technical issues. Sounds like you are using an analytics import goal in which case you must go through my guide mentioned.

Thanks for this tutorial. But if I just pasted this code provided without some further edits it would be wrong correct? Just want to make sure, in step #2, with web browsers with javascript disabled. I can’t just paste that code provided here, without also making sure my conversion_id, conversion_label and conversion_currency match my original code provided by Google right?

Hey Joshua, thanks for the tutorial,
In the script i get from Google i don’t have the line : var google_conversion_value = 1.00;
Should i add anyway : if ({{ subtotal_price }}) { var google_conversion_value = {{ subtotal_price | money_without_currency }}; }

When setting up the conversion code in AdWords, select the value field that is suggested in the guide. This insert the google_conversion_value line. It may work if you insert the custom-coded line, but just follow what is suggested.

Thanks for the tutorial Joshua..
In the “Shopify additional content & scripts” in the checkout tab, I already have a code for google trusted stores, so can I just put both codes together; one after another? or this won’t work?

Hi Joshua,
In an email, I asked you if I should use the same conversion tracking tag for two separate Shopify stores and you told me to create a new conversion code for the second store.
However, when I try to create a second code, Adwords just keeps giving me a code with the same conversion ID. So, how do I go about creating a second tag with a unique conversion ID?
Thanks!
Norma

Hi Josha – i just edited per your instructions within the additional scripts box on Shopify. But, I pasted the original script from Google right beneath the affiliate conversation tracking script – is this OK?

Will this now need updating inline with the new Google Conversion tracking pixel? E.g I have received this email from google “We strongly recommend that you replace your pixel-only conversion tags with the new website conversion tracking tag in AdWords. The pixel-only conversion tags that you are currently using on your site(s) are unable to measure conversions on Safari. If you don’t take any action you will no longer be able to measure conversions on Safari.

The new tag consists of two snippets that are only available in the new AdWords experience, which is now accessible to all advertisers. Here are the steps you should follow to create and implement the new tags:
1. Log into the new AdWords experience (the Conversions page)
2. Click the website conversion action for which you want to update the tag
3. Expand the “Tag setup” panel at the bottom of the page
4. Follow the instructions on this page to install both tag snippets:
a. The global site tag snippet should be placed on all pages of your website so it can set new cookies on your domain, which will store information about the ad click that brought a user to your site. You only need one global site tag snippet across your entire website, even if you track multiple actions.
b. The event tag snippet should be installed on the conversion page(s)”

Yes Anthony, it can be updated. Accounts are still in transition to the new AdWords interface and following the above tutorial still works great for everyone and will continue to. I will update it probably in a few weeks. It’s a lot simpler to do. The code you’ll want to use for registering a conversion is:

It will need to go in the “Additional Google Analytics Javascript” section. However, you cannot copy and paste the code. I have started to work on a solution for the new tag, but this is not confirmed to work:

Hi Joshua
Thanks very much for your instructions which I have followed for our website at http://www.losari.com.au.
Some of our clients use discount codes and I have just noticed that the sale amount are being reported in Analytics with the full purchase price, rather than the discounted price. Are you able to please tell me how to amend the Adwords conversion code to take the discount into effect?
Many thanks
Jonathan

If you’re using the new AdWords interface, which most AdWords accounts are now, you will get the new gtag code. I do not advise using it because Shopify is not yet setup for that tracking code. Swap back to the old interface and you will be able to get the “old” code I suggest.

I set up Google Ad words tracking exactly like this but I’m still not getting an accurate reporting. When I look at my Google Anaylitcs report for Adwords it’s different than the number of conversions I have in Google Adwords dashboard. Is it cause conversions are set to 30 days from the first click? or something else that could cause Google Adwords to report more conversions than I’m getting daily?

It sounds like you’re not using Shopify’s native Facebook pixel integration as that has its own field. If your FB pixel is in the additional, yes, the Google Conversion Pixel code can also be in there. Other codes can be inserted there.

Hi Joshua, I added the code as per your tutorial however my conversions aren’t being tracked anymore. Do I need to the event snippet for sales conversion page on the thank you page that you mentioned? I can’t see that page in my files. Thanks in advance.

I’ve had Shopify look at the code and I’m waiting for a reply.
Also, I realised that the shopify thank you page is the page where the code is added under settings.
Everything is setup correctly as per your tutorial but no conversions are coming through now so I’ve reverted back to the old code.

If you’d like to me to resolve any tracking or analytics issues Jared, I suggest reaching out to me on the contact form. It is something you want right, otherwise you will just mindlessly blow through ad spend.

I have a question. I have configured the Global Configure Tag as part of the Google Analytics Tracking code in the Online Store Preferences as I want to measure conversions in other pages (signups and similars). So I guess that my Global Configure Tag is for all pages and not only for the checkout page.

Should I use the “{ ‘send_page_view’: false })” under this configuration or it applies only when the Global Tag is set only for the checkout page?

gtag does not work with Shopify’s default analytics setup so I do not suggest using it there. If you want to use it “site wide” (which will exclude the checkout and is unavoidable), put the same global tag mentioned in the guide that excludes sending pageview data, in the theme.liquid file.

Interesting observation Carlos. Don’t worry about Google’s Tag Assistant in that case. You can confirm the value yourself by:

You can immediately test the tracking is working by viewing the thank you page for an order then search the source code for the snippet to confirm the values inserted for the order ID and conversion value are what you want. If you’re using {% if first_time_accessed %} around your AdWords tracking, temporarily remove that so you can view the order status of an existing order.

Hi Carl. I’m unsure how your exact currency is displayed. If the remove and replace filter example is right for you (which you can test by viewing it on the order status page – see the guide on how), then use: {{ subtotal_price | money_without_currency | remove: '.' | replace: ',', '.' }}

How do I do this with Google Tag Manager instead of installing the snippet into the theme.liquid? If I’m guessing correctly, I still have to use the snippet on the Setting > Checkout page in Admin and in the Additional Scripts box unless there is a way to make that Conversion Linker Tag work.

AdWords tracking in GTM is completely different to what this tutorial teaches. I suggest you read GTM tutorials if you’re asking about tag firing sections. They will help you more. I prefer to use the method in this article for all clients as it’s quick.

The only issue with having it in the <body> like it is, is if people leave the page before the code gets a chance to load. This is so unlikely for someone who has just made a purchase. By the time the words on the page load, the tracking will have loaded.

Great post – just what I was looking for! Your Shopify guides have been really helpful over the past couple of years! For this one, the conversion script is straight forward, but I’m still a little unclear as to where the gtag/Global Site tag should be located. We currently have the following installed in the two areas of Shopify:

Is this the suggested setup? I’m just unsure if we should have a version of the Global site tag in both the Shopify online store preferences and ALSO in the Shopify settings checkout scripts area. Any additional pointers would be greatly appreciated!

This is a guide for Google Ads conversion tracking, but I answered your question in the tutorial. If you want to install gtag, you can use the suggested global gtag that has the send_page_view option set to false. I suggest putting it in the theme.liquid file. I don’t know if putting it in the additional scripts section is functional, though that is pointless given Shopify is not gtag compatible and you’d get everything you need.

Good post, thanks for sharing. Can I clarify why gtag('config', 'AW-880123456', { 'send_page_view': false }); is needed? I thought this was to stop sending page view data to GA, however it appears you have appended this to the Google Ads account. Thanks.

Why do you recommend bother searching for and inputting AOV when the code is going to be changed anyway? Also, I think you should make it clear when adjusting the gtag not to get the adwords code mixed up with your sample code.

This is pretty cool. I especially like the localisation side of switching decimals to comma’s and the run once, which I’d never come across with Shopify, but makes sense from having localisations and internationalisation experience in other e-commerce and wider software. Thanks for writing up, especially the tips.

Hi Joshua – your tutorial is by far the best I have found. However I am still having issues when debugging (and verifying) the installed solution to Google Ads. My conversion actions page still indicates unverified. I have seen and verified the solution like you explained and it seems to be correct in the page but however when debugging through Chrome webdeveloper your script doesn’t trigger googleadservices.com like said in the Google Ad debugging instructions. Also when using the Google Tag Assistant I only see the global site tag but not the triggering conversion. Any ideas?

If you use Shopify’s Google Analytics setup and install the global site tag in your theme, you will send duplicate page view data. You need to use the send_page_view parameter like { ‘send_page_view’: false } to disable duplicate page views sent to analytics.js.

This solution combines the Google Ads conversion tracking with the Google Analytics global site tag. It stops duplicate page view data when the store uses Shopify’s settings for Google Analytics. You would use this solution if you wanted to send other data in gtag.js like dynamic remarketing or an event via gtag.js.

I would like to add the Global Site tag everywhere on my site in order to enable remarketing and I understand why it makes sense to set send_page_view to false. However, could I instead just not include the line “gtag(‘config’, ‘UA-76118106-1’);” in the Global Site tag (both in the theme and on the checkout page) at all?

We are using Shopify’s standard Google Analytics setup so I don’t know why I’d also want to include “gtag(‘config’, ‘UA-76118106-1’);” in the Global Site tag. It seems like it would be repetitive to include and lead to double counting page views unless there is some other interdependency that requires keeping that line of code?

I’m just not sure why I’d want to include “gtag(‘config’, ‘UA-76118106-1’);” in the Global Site tag in the theme and/or the additional checkout scripts if I also use Shopify’s standard Google analytics tag? Is it required in the Global Site tag to use remarketing? Maybe some other functionality / reason requires it in the Global Site tag even though we also use Shopify’s standard Google Analytics implementation?

My understanding is the gtag config command is required setup if you want to do anything with Google Analytics gtag (such as dynamic remarketing.) The setup you quoted that I described will work well and not double count page views. I don’t know why you’re looking to exclude the config.

It sounds like if we do standard Adwords remarketing we could implement the Global Site tag without the line gtag(‘config’, ‘UA-76118106-1’, { ‘send_page_view’: false }); because standard Adwords remarketing only needs the Global Site Tag and a conversion event tied to our Adwords gtag. Basically, standard adwords remarketing doesn’t require a Google Anlytics gtag so we wouldn’t need to include it at all?

But to do Dynamic Remarketing we would want to include gtag(‘config’, ‘UA-76118106-1’, { ‘send_page_view’: false }); since Dynamic Remarketing requires the use of Google Analytics gtags? Further, not only do we need to include the Google Analytics gtag, we also need to use ‘send_page_view’: false to avoid double counting page views. The same would be true of anything else that required the use of Google Analytics gtags.

I have implemented the conversion tracking as described above. However the source code of the order status page (which I assume is the “thank you page” mentioned above) returns an error called “unexpected token” for the value line:

‘value’: {{ checkout.total_price | money_without_currency }},

The total price is not shown, instead I see the error. At the same time, the Id is represented correctly in the source code.

I finally found the problem: The order I was testing with has not been placed online via the checkout process, but was generated as draft. This results in {{ checkout.total_price | money_without_currency }} having no value.

So there is not really problem, as we are measuring online conversions here, which is not the case for manually generated orders. It is just a bit confusing if you end up doing your tests with such draft-based orders…

Thanks for this wonderful content, pls I want some clarifications, At the moment, I am tracking call conversions and form submissions on my website and I have installed the global site tag on every page of the website.

Now, I want to configure the purchase conversion in my store which is a shopify.

This is my question, should I install another global site tags or should I only cope the event snippet and edit it as you outlined in your guilded steps here. Thank you

Hi Joshua,
thank you very much for your step-by-step guide. I did everything you teached, but when i go in my shopify backend to paste in the code there is no field for addtional script. I go to “settings” –> “checkout” but there is no text-box for additional scripts.

1. Do you have any idea why i don’t have the textbox for additional scripts?
2. Where else can i past my block of code?

Hi Joshua,
I installed the Google Ads tags as you’ve shown above, however when checking the setup with Google Tag Assistant it shows 2 tags installed when a purchase is completed.

I’m really hoping you can please clarify 1 thing for me:

Should I remove the Google Analytics account number from the box above the Additional Google Analytics JavaScript box? Or do I leave my Google Analytics account number in this box as well as adding the Global site tag into the Additional Google Analytics JavaScript box? I think this may be why I’m getting 2 tags firing on checkout when I test the code, but I may be wrong. I’m a newbie at this!

Had a call with the Google Implementation Team which helped us implement the gtag for one of our accounts on the Shopify platform.

Some background info:
We have two separate AdWords accounts. One houses the text ads and remarketing, the other houses the PLAs.

The issue has been how do we add the new gtag tracking for both accounts?

It seemed that what the Google Implementation Team did work, however, now some conversions are tracking the correct conversion value, but the majority are not and are showing the value as 0.

Below is the source code on an order confirmation page which was implemented into the “Additional Scripts” box. Wondering what you think about this implementation and if you have any suggestions? We have had issues switching over to the gtag, (or Tag Manager) with a lot of our accounts. Any help would be much appreciated.

Get Your Free 7-Part Shopify Marketing Course:

Learn how to get more buyers to your store, little design tweaks that increase sales, and Shopify short-cuts that save you time managing your store. Join over 2,470 subscribers who have completed the course by entering your email: