Google Analytics 4 (GA4) Integration Idea

pauldrecksler
Excursionist
16 0 9

I've read all the posts on this forum about Google Analytics 4 and how Shopify doesn't support it yet (because they only accept UA tags).

Some suggested that we can manually install the code into our Shopify theme.liquid file in the HEAD section, but that's only a half solution because unless the tag fires on the Checkout page, you're not getting any conversion data. 

My question... can't we simply paste the entire g.tag tracking code into the Settings --> Checkout --> Additional Scripts section and call it a day?

screenshot-rondeno-culinary-designs.myshopify.com-2020.11.22-11_32_20.png

I understand that you need Shopify Plus to edit the checkout.liquid file, but for the rest of us, aren't we accomplishing the same thing by pasting the following complete script into that Additional Scripts area?

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

  gtag('config', 'G-XXXXXXXXXX');
</script>

 

 I just tried this on one of my Shopify sites, so I can't report back whether it tracks conversions, but I will update this thread and let you know. 

Has anyone else tried this on one of their sites and had success?

Join my Shopifreaks Newsletter: www.shopifreaks.com
Learn about affiliate marketing: www.shopaffiliateapps.com
Hire me to help with your store: www.ideasfocused.com

I wish you much success with your Shopify store!
Replies 8 (8)
Wiyre
Shopify Partner
3 0 0

This is a clever idea, but unfortunately it will not work. When you click on "Save" in the "Additional Scripts" section, Shopify will remove key parts of the GA4 code which will make the additional code you paste within the "Additional Scripts" section useless. The only way to have Google Analytics 4 support is to modify the theme.liquid file, which you can do by following the instructions outlined within this video (for those who have the ability to edit the theme code). 

pauldrecksler
Excursionist
16 0 9

@Wiyre if I'm not mistaken though, the video tutorial you referenced also does not include conversion tracking at the Checkout page. So it's ultimately the same issue I was running into earlier where only part of GA4 can be installed. 

Join my Shopifreaks Newsletter: www.shopifreaks.com
Learn about affiliate marketing: www.shopaffiliateapps.com
Hire me to help with your store: www.ideasfocused.com

I wish you much success with your Shopify store!
Wiyre
Shopify Partner
3 0 0

To track with GA4 on the checkout page, you just need to follow the instructions in the video and add the GA4 tracking code to both the theme.liquid and checkout.liquid. Conversion tracking at a more granular level is a bit more complicated, and probably would require you to use some combination of Google Tag Manager + GA4 tracking code. Until Shopify supports GA4 by default (no ETA on this) we are stuck with these types of workarounds. 

MCer
New Member
10 0 0

There is a free apps GA4tify in shopify apps store to implement GA4 on shopify with e-commerce tracking seamlessly. It's totally free. It works for an existing GA4 tag or creating a new GA4 account for you. You may try searching "ga4tify" at https://apps.shopify.com or click https://apps.shopify.com/ga4tify to install it.

Integrate And Track Your Shopify With GA4
https://apps.shopify.com/ga4tify
pauldrecksler
Excursionist
16 0 9

Thanks @MCer I'll try it out in one of my stores. (Although no ETA on when that'll happen unfortunately. We need to get through the holiday season before testing any apps.) 

 

So your app basically installs the code on every page of the site and also has the ability to install the checkout conversion code that we can otherwise not install ourselves without Shopify Plus?

Join my Shopifreaks Newsletter: www.shopifreaks.com
Learn about affiliate marketing: www.shopaffiliateapps.com
Hire me to help with your store: www.ideasfocused.com

I wish you much success with your Shopify store!
MCer
New Member
10 0 0
Our app installed the necessary tags. You can find the page views and
transaction related metrics after the simple installation.

But, you may have to handle the additional script for the checkout page if
you would like to see the checkout counts. We provided you with the
instructions in our app to complete this part.

Thanks for offering feedback in advance!
Integrate And Track Your Shopify With GA4
https://apps.shopify.com/ga4tify
pauldrecksler
Excursionist
16 0 9
Thanks for the clarification. Is Shopify Plus required to add the Checkout
scripts?
Join my Shopifreaks Newsletter: www.shopifreaks.com
Learn about affiliate marketing: www.shopaffiliateapps.com
Hire me to help with your store: www.ideasfocused.com

I wish you much success with your Shopify store!
MCer
New Member
10 0 0
I am not familiar with Shopify Plus. But, I believe the same script is
required for all shopify store checkout page.
Integrate And Track Your Shopify With GA4
https://apps.shopify.com/ga4tify