Section 1.8: Foundations of Google Shopping

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

When running Google Shopping ads, it's vital to your success to keep track of your actual sales amounts generated. Learn how to set that tracking up, step by step, in your Google Ads account.

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

📘 Google Analytics 4: Referral Exclusion List ➤ Read here

👨‍💻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>
				
			

👨‍💻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>
				
			
play watch

Free Google Shopping Course

  • 41 tutorials
  • 5 hr 31 min 26 sec

Add Your Comments & Questions Below

Subscribe
Notify of
guest
51 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Jay
Jay
8 months 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.

Mr Sam Baldwin
Admin
8 months 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
8 months 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

Mr Sam Baldwin
Admin
8 months 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
8 months 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 8 months ago by Michael
Mr Sam Baldwin
Admin
8 months 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
8 months ago
Reply to  Mr Sam Baldwin

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

Krystal
Krystal
8 months ago

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

Jo Vucic
Admin
8 months ago
Reply to  Krystal

Hi Krystal,

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

Ibrahim
Ibrahim
8 months 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
7 months 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
7 months 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
7 months ago
Reply to  Owen

Hi Owen,

that’s only for the “old” GA.

Rocco
Rocco
7 months 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
7 months 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
7 months 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
7 months ago
Reply to  Rocco

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

Owen
Owen
7 months ago

Do you have a script for post-purchase upsell? Do I need to edit anything from this script? Thanks

Jo Vucic
Admin
7 months 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
7 months 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
7 months 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
5 months ago

thank you

Joslynn
5 months 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
Ela Bruce
1 month 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
4 months 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
Ela Bruce
2 months 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
4 months 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
Ela Bruce
3 months ago
Reply to  Filip

Hi Filip,

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

Mike
Mike
4 months 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
Ela Bruce
3 months 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
4 months ago

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

Ela Bruce
Admin
Ela Bruce
4 months 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
3 months 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
Ela Bruce
3 months 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
4 months 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
Ela Bruce
3 months ago
Reply to  Tiff

Hi Tiff,

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

Naomi
3 months ago

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

Ela Bruce
Admin
Ela Bruce
3 months 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
3 months ago

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

Ela Bruce
Admin
Ela Bruce
2 months ago
Reply to  naj

Hi Naj,

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

naj
naj
3 months 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
Ela Bruce
2 months 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
2 months 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
Ela Bruce
2 months 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
2 months 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
Ela Bruce
2 months 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 month 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
Ela Bruce
1 month 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 month 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
Ela Bruce
1 month 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 month ago
Reply to  Ela Bruce

Hi Ela, thanks for confirming.