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 type="rocketlazyloadscript" async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script type="rocketlazyloadscript">
ย  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 type="rocketlazyloadscript" async src="https://www.googletagmanager.com/gtag/js?id=KEYCOMMERCE"></script>
<script type="rocketlazyloadscript">
  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
26 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Jay
Jay
5 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
4 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
5 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
4 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
4 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 4 months ago by Michael
Mr Sam Baldwin
Admin
4 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
4 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
4 months ago

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

Jo Vucic
Admin
4 months ago
Reply to  Krystal

Hi Krystal,

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

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

Hi Owen,

that’s only for the “old” GA.

Rocco
Rocco
3 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
3 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
3 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
3 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
3 months ago

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

Jo Vucic
Admin
3 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
3 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
3 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
1 month ago

thank you

Mike
Mike
11 days 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
2 days 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
10 days ago

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

Ela Bruce
Admin
Ela Bruce
8 days 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.