play watch

Free Google Shopping Course

  • 41 tutorials
  • 5 hr 31 min 26 sec
Section 1.8: Foundations of Google Shopping

How to set up conversion tracking with Google Analytics for Shopify and Google Ads

If you're using Google Ads for your Shopify store, understanding how well your ads turn into actual sales is super important.

In this guide, we'll take you through simple steps to set up conversion tracking. This way, you can see how successful your Google Ads campaigns are for your Shopify store.

Step 1: Get a Google Analytics Account

Start by making a Google Analytics account, and connect it to your Shopify store.

Go to analytics.google.com, log in with your Google account, and fill in some basic details.

Choose your business goals, especially for selling things online. Agree to the terms, and then set up data collection for your website. Follow the steps in the video to install this on your Shopify store.

👨‍💻Google Analytics Code For Your Theme

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

  gtag('config', 'GA_MEASUREMENT_ID');
</script>
				
			

Step 2: Check if Google Analytics is Installed Right

After installing Google Analytics on your Shopify store, make sure it's working. Test it by clicking around on your store's pages.

Sometimes it takes a bit to start working, so don't worry if you don't see results right away. You can also try refreshing the analytics page or checking on a private mode or mobile device.

Step 3: Include Sales Data

Now, let's make sure you're tracking sales.

  • In your Shopify settings, find ‘Checkout,' and go to ‘Additional Scripts.'
  • Copy the script from below and paste it there.
  • Replace ‘KeyCommerce' with your Analytics ID.

This helps send info to Analytics when someone buys from your store.

Don't forget to exclude Shopify and payment providers from analytics referrals, save the changes, and you're set.

👨‍💻Google Analytics Code For Your Order Confirmation Page

				
					<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=KEYCOMMERCE"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'KEYCOMMERCE');
{% if first_time_accessed %}
gtag("event", "purchase", {
    transaction_id: "{{ order.order_number }}",
    value: {{ total_price | times: 0.01 }},
    tax: {{ tax_price | times: 0.01 }},
    shipping: {{ shipping_price | times: 0.01 }},
    currency: "{{ order.currency }}",
    items: [
     {% for line_item in line_items %}
     {
      item_id: "{{ line_item.product_id }}",
      item_name: "{{ line_item.title | remove: "'" | remove: '"' }}",
      currency: "{{ order.currency }}",
      price: {{ line_item.original_price | times: 0.01 }},
      quantity: {{ line_item.quantity }}
    },
    {% endfor %}
    ]
});
{% endif %}
</script>
				
			

Step 4: Connect Google Analytics to Google Ads

For a complete picture, link your Google Analytics account to your Google Ads account.

  • Go to ads.google.com, find ‘Admin.'
  • Click ‘Linked Accounts,' and connect Google Analytics GA4.

Make sure to turn on metrics and audience toggles before linking.

Step 5: Set Up Conversion Tracking in Google Ads

In your Google Ads account, create a new conversion action.

  • Choose ‘Import,' and pick Google Analytics 4 and Web.
  • Confirm your account details.
  • Click ‘Import,' and ‘Continue.'
  • Click ‘Done,' and you're all set.

Following these simple steps helps you track how well your ads turn into sales on your Shopify store. Having this info lets you tweak your ads, make them better, and get more out of your online store.

Resources

Recommended lesson:

🎥 What is Google Merchant Center and how does it work? ➤ Watch here

Additional resources:

📘 Filter domain referrals ➤ Read here

📘 [GA4] Identify unwanted referrals ➤ Read here

Add Your Comments & Questions Below

Subscribe
Notify of
guest
74 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Jay
Jay
1 year ago

The conversion code that is needed to copy and paste in Shopify additional scripts not on the page. It mentions it being just below the video, but the code that is here isn't the same as shown in the video.

Sam
Admin
Sam
1 year ago
Reply to  Jay

Hi Jay,

thanks for pointing that out, we just updated the page with the code for your order confirmation page.

Ayman
Ayman
1 year ago

Hi, if you could also send the Google Analytics code; the one to put in the Shopify order status page seems to be missing

Sam
Admin
Sam
1 year ago
Reply to  Ayman

Hi Ayman,

Thanks for pointing that out, we just updated the page with the code for your order confirmation page.

Michael
Michael
1 year ago

The script code posted below this video to copy and paste is completely different than what is shown in the video? You really stress how important it is to have conversion tracking setup correctly, I just want to make sure and do this right the first time. Can you please help clarify? Thanks so much 🙂

Last edited 1 year ago by Michael
Sam
Admin
Sam
1 year ago
Reply to  Michael

Hi Michael,

Thank you for pointing that out; indeed, it's vital to correctly set up the conversion tracking!
We just added the code for your order confirmation page.

Michael
Michael
1 year ago
Reply to  Sam

Thank you Sam! What an amazing course you guys have put together, providing so much value!

Krystal
Krystal
1 year ago

Hi Sam, Could you help send the correct code as you mentioned in the video?
Thanks in advance~

Jo Vucic
Admin
1 year ago
Reply to  Krystal

Hi Krystal,

we updated the code snippets under the lesson to the correct code.

Ibrahim
Ibrahim
1 year ago

Thank you Sam for your valuable content

Regarding conversion settings. Just “purchase” to add?
What about ATC, VIEW CONTENT AND OTHERS?

What about dynamic remarketing codes? Should we install another code? or it is included by default in the GA4 tag?

Jo Vucic
Admin
1 year ago
Reply to  Ibrahim

Hi Ibrahim,

You can definitely add all events that matter to you, just make sure they're not showing up as conversions in Google Ads, but secondary conversions in the “All conv.” column.
There's no dynamic remarketing code in GA4 as of yet.

Owen
Owen
1 year ago

At 8:30, for enhanced e-commerce, is that only for the Old GA property? Or for both old GA and GA4?

Jo Vucic
Admin
1 year ago
Reply to  Owen

Hi Owen,

that's only for the “old” GA.

Rocco
Rocco
1 year ago

Guys, thank you so much for all of this. Hopefully it'll help me to reach the level where I can hire you 🙏👍

Rocco
Rocco
1 year ago

Hi Sam,

I'm stuck at the step where I need to add unwanted referrals. When I come to that ‘more tagging settings' menu, I get a message: “You do not have permission to access these settings.” I googled and tried to implement everything I found, but Nothing worked.

Do you have any idea how to fix it?

Any advice would be highly appreciated.

Thank you in advance for your answer.

Best,
Rocco

Jo Vucic
Admin
1 year ago
Reply to  Rocco

Hi Rocco,

It's hard to say, but this might be an access problem. Do you have admin rights on the account?

Owen
Owen
1 year ago
Reply to  Rocco

I'm facing the same issue. Apparently it's a new bug according to Google forums and stackexchange.

Owen
Owen
1 year ago

I'm facing the same issue. Apparently it's a new bug according to Google forums and stackexchange.

Jo Vucic
Admin
1 year ago
Reply to  Owen

Hi Owen,

Unfortunately, no, but the script will depend on the app you're using for upsells, so it's best to start from their documentation.

Alex
Alex
1 year ago

Hi Sam! The Order Confirmation Page code seems not to be working or sending ecommerce data to GA4. I've installed it yesterday and still no data. We made thousands in the meantime. Any suggestion?

Jo Vucic
Admin
1 year ago
Reply to  Alex

Hi Alex,

It's hard to say without seeing the full setup, but I would wait for a few days, it takes some time for GA4 to start collecting data.

youness chokri
youness chokri
1 year ago

thank you

Joslynn
1 year ago

Hello, I am using WP and Alidropship plugins, does all this work the same for me as it does for Shopify stores or do I need to do something different?

Ela Bruce
Admin
1 year ago
Reply to  Joslynn

Hi Joslynn,

It's difficult to tell if it will work as every theme is different, however in theory it should work the same.

Elizabeth
1 year ago

Hi there, loving your course! I already have Hotjar script in the order status page in Shopify, can i just enter down & add the google script as well?

Ela Bruce
Admin
1 year ago
Reply to  Elizabeth

Hi Elizabeth,

Yes that should work, just make sure that it is right at the bottom, and you're not pasting in the middle of any other code.

Filip
Filip
1 year ago

Hey Sam, the code seems different here from the video. Is this a better one updated or the one that you use from the video? We are talking about Shopify checkout page tracking conversions/purchases.

Ela Bruce
Admin
1 year ago
Reply to  Filip

Hi Filip,

The one on the course page, below the video, is the correct one to use.

Mike
Mike
1 year ago

Hi Sam, chiming in. Just implemented this snippet above and did a purchase of a test product on my store for $1. The revenue is tracked on UA but not GA4. Installed both your snippets. Ideas or does it take 2 days to track?? Thanks Mike

Ela Bruce
Admin
1 year ago
Reply to  Mike

Hi Mike,

Thank you for the question. You might have to wait at least a day to see data in GA4. We usually won't look at data from the same day because the processing takes more time than in GA UA.

Tiyana
Tiyana
1 year ago

Do the tracking codes provided by Google Analytics and Google Ads track conversions?

Ela Bruce
Admin
1 year ago
Reply to  Tiyana

Hi Tiyana,

The tracking code provided will set up Google Analytics tracking, once setup you can then import them into Google Ads as conversions. This means the conversions you see in Google Ads will match those of Google Analytics under the cpc medium of traffic.

Tiyana
Tiyana
1 year ago
Reply to  Ela Bruce

Okay. On Google Ads now, under “conversion action settings” > “value”, it doesn't have the same option as shown in the video. It offers “use the same value for each conversion,” “use different values for each conversion,” and “don't use a value for this conversion action (not recommended)”.

Which would you recommend we use, and will this work with the code we are copying from here?

Ela Bruce
Admin
1 year ago
Reply to  Tiyana

Hi Tiyana,

Google keeps improving the backend, so some options vary in nomenclature.
We want google to track exactly the value of the conversion, so we can know how profitable it is. That is why we use “use different values for each conversion” in Ecommerce.

If we were optimising for Leads or Calls, as they don’t have a conversion value, we would assign one based on our history.

Tiff
1 year ago

Hey Sam and Team – amazing videos thank you! The script on this page below the video is very different to the one in the video. I can see a lot of comments about this. But I just wanted to confirm that the script on the page right now is the correct one?

Ela Bruce
Admin
1 year ago
Reply to  Tiff

Hi Tiff,

The one on the course page, below the video, is the correct one to use.

Naomi
1 year ago

I use WIX and I don't know where to put the checkout code. Please help 😫

Ela Bruce
Admin
1 year ago
Reply to  Naomi

Hi Naomi,

Unfortunately, we don't work with WIX sites, so I think the best thing would be to ask the WIX support team for assistance.

naj
naj
1 year ago

the global site tag is not available to copy the text , I think it keeps changing and updating

Ela Bruce
Admin
1 year ago
Reply to  naj

Hi Naj,

You need to get the correct Global Site Tag from your Google Analytics account.

naj
naj
1 year ago

I couldn't understand why do we have to remove payment gateways and shopify as a referral? I mean why we do not want the shopify checkout pages to come in our reports, what happens if it comes?

Ela Bruce
Admin
1 year ago
Reply to  naj

Hi Naj,

We advise removing the payment gateways to organize and make our sales reporting accurate. We will still count sales from the gateways, but Google will be able to attribute the sale source correctly rather than give credit to the gateway. When not removed, you will lose valuable reporting and tracking of where the sale came from.

For Example, if you don't remove the payment gateway, you may have 7 sales on your store in one day. 6 of the sales can be attributed to Google /CPC, and 1 sale is attributed to Shopify checkout. We know the checkout is an internal page, and a customer will have to find your website from a source such as paid ads, and organic social, but Google doesn't make the distinction.

Even just 10% of sales attributed to checkout and other payment sites will take away from being able to judge your marketing channels effectively.

Frank
Frank
1 year ago

Hi Guys. First of all, thanks for this amazing course and all the valuable information. I have been told that the latest and correct way to track conversions and events is through the Google Tag Manager and using the Data Layer. ¿What do you think about that?

Ela Bruce
Admin
1 year ago
Reply to  Frank

Hi Frank,

Thanks for the feedback; we are glad to hear our content has been of value to you!

Regarding Data Layers, they are advanced ways of tracking essential data from your conversions. We use them to track purchases, transaction IDs, the total price of items sold, currency, and more. There is an endless way of using data layers to track data valuable to you. In our course, our conversion tracking guide provides instructions and codes on tracking all of the data mentioned above with data layers within.

Here's the specific video https://keycommerce.com/google-shopping-course/conversion-tracking-setup-google-ads-google-analytics-shopify/
Here's a link from Google on the ways you can use data layers, too https://developers.google.com/tag-platform/tag-manager/web/datalayer

Katja
1 year ago

Hey thank you for your course! It's absolutely amazing. I have been able to follow it super easily until this particular part. I'm using Woocommerce and I am not sure where to add the second code on my website. I have installed google tag manager on my site and tried adding this as a custom HTML tag, but unfortunately this didn't work. Is there an easy way to add this code to my wordpress site? Thanks in advance

Ela Bruce
Admin
1 year ago
Reply to  Katja

Hi Katja,

Most code snippets will be added to your WordPress theme’s functions.php file. However, it can be tricky and you could land up breaking your site. I recommend installing a plugin such as WPcode to make it easier.

Ryan
1 year ago

Hi Sam and Jo, do you ever use the subtotal price instead of the total price to remove shipping from conversion tracking?

Does this not make it easier to figure out the profit margin metrics in Google Ads? I may be thinking about this the wrong way. I would love to hear from you!

Ela Bruce
Admin
1 year ago
Reply to  Ryan

Hi Ryan,

Typically, we track the total sales value, so what the customer is charged on the website, we have that figure fed back into our conversions.

This way, Google sees the conversion value, and we can optimize bids accurately. Profit margins can be worked out at the store level; you can use the margin to work out your Break Even ROAS, which will then dictate what ROAS your campaigns need to be at to be profitable. We have a few videos discussing how we approach this; here's one for you – https://www.youtube.com/watch?v=rCf7IwFjaic

Guy
Guy
1 year ago

Hi there. When editing the Conversion Action Settings – Attribution Model – the video suggests to select “Linear”. I am just setting it up now and there is a “Data-driven” option which is recommended by Google. Just wanted to check if “Linear” is still the best option? Thanks!

Ela Bruce
Admin
1 year ago
Reply to  Guy

Hi Guy,

When picking your attribution model, Data Driven is now the best option we recommend. It allows Google to capture more sales conversions and assisted conversions regardless of the different customer touch points.

Guy
Guy
1 year ago
Reply to  Ela Bruce

Hi Ela, thanks for confirming.

Debrah K.
1 year ago

Great information but Shopify does not currently link with GA4 (supposed to include March 2023) so some of the instructions were a bit confusing since we have to use the legacy GA platform.

Muzna
1 year ago

Indeed an informative course. So much to learn. I am using woo-commerce so do I put the code in body section or head?

Ela Bruce
Admin
1 year ago
Reply to  Muzna

Hi Muzna,

We recommend that the code be placed inside the header section.

Leonora
1 year ago

Hi! I'm at minute 7 and I'm following the steps, but I can't find the “More tagging setting” in my Data stream! In fact I still see the instruction on how to install google tag, even if I did it already!
What should I do?
Thanks!!!

Ela Bruce
Admin
1 year ago
Reply to  Leonora

Hi Leonora,

How long ago did you set up the GA4 tag? It can take up to 48 hours before you have the option to make this change. Keep in mind, that you need to have full admin access. Google has an additional written step-by-step for removing unwanted referrals.
null
null

Leonora
1 year ago
Reply to  Ela Bruce

Hi Ela, thank you for your answer. I did the set up two days ago, and I looked verify, but still I can't find the More tagging setting in my Data Stream. Now in addiction I can't watch the video from this page no more. Is that normal?
Thank you again
Leonora

Ela Bruce
Admin
1 year ago
Reply to  Leonora

Hi Lenora,

There shouldn't be any reason why you can't watch the video on this page. If you are still struggling, try watching the video on our YouTube channel: https://www.youtube.com/watch?v=mTGEqpTZ5nU

Also, I've just found out that GA4 has made updates since we filmed the tutorial; now to access the referrals you need follow these steps:
Go Into Admin -> Data Streams -> Stream -> Configure tag settings -> Show all -> List unwanted referrals
The Show all button will show the area you need in the data stream, see the photo attached.
Screenshot

Leonora
1 year ago
Reply to  Ela Bruce

Hi Ela, thank you again, I follow all the steps and it worked out!

Ela Bruce
Admin
1 year ago
Reply to  Leonora

Glad we could help 🙂

Conor
1 year ago

HI team, I believe I updated my google ads account to have both GA4 and our Universal analytics. However when I click on the data stream to add the inclusions, there is so no such option as “add more tagging settings”. does anyone know why we dont have this option?

Ela Bruce
Admin
1 year ago
Reply to  Conor

Hi Conor,

GA4 has made updates since we filmed the tutorial; now to access the referrals you need follow these steps:
Go Into Admin -> Data Streams -> Stream -> Configure tag settings -> Show all -> List unwanted referrals
The Show all button will show the area you need in the data stream, see the photo attached.

Screenshot

Conor
1 year ago
Reply to  Ela Bruce

Thanks for that Ela. For some reason I cant see any of the video lessons anymore. Have they been taken down, or is my computer playing up. Under unwanted referrals, do we put our domain? thanks

Ela Bruce
Admin
1 year ago
Reply to  Conor

Hi Conor,

We did not remove any videos from the pages. Perhaps try clearing your cache? If the problems persists let me know.

Yes, under unwanted referrals you can add your domain.

ishaan
ishaan
1 year ago

Can I go With GTM to connect Google Analytics with Shopify or its preferred to link directly
THANKYOU

Ela Bruce
Admin
11 months ago
Reply to  ishaan

Hi Ishaan,

With GTM, you can track more advanced data like product clicks, promotions, and cart abandonment rates and set up custom tracking based on business goals. This can provide more detailed insights into the store's performance and customer behavior. But both methods can provide accurate and valuable data

Ray
Ray
1 year ago

Sam that was freakin insane! This episode alone easily worth $5k…

Ela Bruce
Admin
11 months ago
Reply to  Ray

Thank you Ray, we're glad you got value from the course:)

louise
11 months ago

Hi, I set up my GA4 through the shopify app – would i still need to add the code manually or would it confused analytics and start to duplicate the data automatically sent from shopify?

Ela Bruce
Admin
10 months ago
Reply to  louise

Hi Louise,

You don't need to add it manually if it's set up through the Shopify app. It would duplicate the data, as you said.

Rose
Rose
5 months ago

About “Attribution Model”, I can't choose “Linear”. Is it okay if I choose another one?

Ela Bruce
Admin
5 months ago
Reply to  Rose

Hi Rose,

Since June 2023, you're only able to select data-driven or last-click attribution. You can read about it more HERE. We'd recommend data-driven attribution.

Bartosz Sliwinski
3 months ago

Hi Guys

I am watching your cours and definately want to give it thumbs up.
I already run a store, got GMC and Google ads set up running ads.
Had google analitics but they changed to Google Analitics 4
You explain how to connect google analitics to shopify, my website is run on Magento, are you able to help connecting google analitics 4 to magento and do the configuration? Or maybe have you got some sort of instruction?

I am running ads at the minute but my goal this year is to msdter it as I can see that I am loosing money and I can see a potential they could be running much better.

I definately would like to get to the point where I will be abke to give it to yu guys to take it over but there is still a bit of a way for me….

I will await your response, thank you so much for you help.

Ela Bruce
Admin
3 months ago

Hi Bartosz,

We don't work with Magento stores at the moment, and are unfortunately unable to assist you with this. I suggest you reach out Magento support directly.

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
page
post

Subscribe to Our Newsletter to Improve Your eCommerce Digital Marketing!

Thank you for your interest in our newsletters. We will send you only the most important news and updates. No spam, we promise.

We are committed to protecting your privacy, as described in our Privacy policy.

What’s your goal today?

1. Hire us to grow your ecommerce store

We’ve generated millions for our clients, using the methods we’ve developed over years with a singular focus on Google Ads for ecommerce. To discover how we can help grow your business:

Claim your FREE website strategy session with one of our renowned experts.

2. Learn & develop your ecommerce skills

Watch our highly regarded YouTube channel, followed by over 23,000 store owners and ecommerce learners from around the world.

You can also subscribe to our weekly email newsletter to get real-world tested growth and optimization strategies, as well as notifications on anything you may need to know as an ecommerce store owner.

Browse our blog, written and structured to be the best resource in the world for anyone starting and growing their online store. It includes strategy guides, setup instructions, checklists, and tools.

Explore our KeyCompendium, which is a comprehensive wiki of digital marketing terms. Many readers have commented on the usefulness of this content.

3. Join our team

If you want to join our team—or discover why our team members love working with KeyCommerce—then see our “Careers” page.

4. Contact us

We help ecommerce store owners around the world, so get in touch!