How to upgrade to Google Analytics 4?

Solved
Keegan_
Tourist
9 0 17

Hi everyone,

 

I've just heard about GA4 and it sounds good.

 

I've just created a new property, but wonder how I implement it in my Shopify store?

 

Or will the existing account connection provide the new tracking ID?

 

Thanks.

Replies 81 (81)
ekuplu
Shopify Partner
43 0 15

Hello, @Neitsabes

Thanks for your nice words on the tutorial. Glad to hear it was helpful. 

It is true that you will not have a chance to add GA4 or GTM tags on the checkout steps if you are not a Shopify Plus client. However, it will not cause a big issue. 

The session will get interrupted, yes. But when the thank you page is loaded; the GTM & GA4 code will still be there and GA will read the cookie and relate the sessions. So traffic sources and similar reports will actually work fine. Of course, it will not be 100% accurate but it will still work great. 

We take the exact same approach with Analyzify clients and they are quite happy with their Google Analytics reports. If you want to learn more about it; I'd recommend the following articles from our website: 

I hope it was helpful. 

Complete Tutorial: Setup GA4 on Shopify including E-comm Reports

Data Analytics & Marketing Focused Content Platform for Shopify Merchants: Analyzify Hub

Check out our free Shopify - Google Tag Manager Course on Youtube
mfcss
Explorer
57 6 22

Any updates on this? This has to be supported natively by Shopify, anything else is not a proper solution.

 

Just as an example of this: Adding the gtag.js code after the <head> in the theme.liquid reduces my pagespeed on all pages by 10+ points. This is simply not an acceptable implementation and must be possible to improve by properly implementing this natively.

 

Shopify needs to get on this asap.

khoff
Excursionist
19 0 9

GA4 will be the ONLY analytics next year. Has Shopify NOT done anything about this yet? I am still seeing that they don't support GA4.

ekuplu
Shopify Partner
43 0 15

I'm sure the Shopify team is working on the implementation. We don't exactly know when it'll be available. In the meantime, you can use our free solution: Shopify GA4 Kit, and have the most important events up and running without using an app or hiring an expert. 

If you want to have a more comprehensive setup & more data flowing into GA4; you can consider using a paid app. 

Complete Tutorial: Setup GA4 on Shopify including E-comm Reports

Data Analytics & Marketing Focused Content Platform for Shopify Merchants: Analyzify Hub

Check out our free Shopify - Google Tag Manager Course on Youtube
KCC1
Tourist
6 0 7

So i've just had a conversation with Shopify support & I'm dumfounded! Firstly I was told GA4 isnt supported & there are no timelines, when I asked how I get access to checkout.liquid so I can do this all myself, I cant without paying a load of money.... after expressing my amazement at this, I was told that a feature request will be submitted to the merchant team for the GA4 support.... I kind hope they're already on it!? 
I dont want to lose and year on year data trends because shopify dont have their stuff together, has anyone been able to get anything setup? 

khoff
Excursionist
19 0 9
This really needs to be in place on Shopify before the end of this month or we are already missing out on year over year data since Universal analytics stops working July 2023. Shopify probably thinks they have a full year to get this done (or like everything else here, they are just waiting for a 3rd party to do it for them -- yet another paid app/service we have to rely on someone else to do).
ekuplu
Shopify Partner
43 0 15

We have prepared an open source & Do-It-Yourself solution and tutorial. You can check it out here: https://www.youtube.com/watch?v=hag6ucGxj5E

 

With this setup, you can already start collecting data on your GA4 property. It also counts the purchases correctly. 

(Sorry for the repeat on the topic; I've just received the notification and wanted to answer. I haven't realized my latest message is just above the question. I couldn't find a way to delete this message) 

Complete Tutorial: Setup GA4 on Shopify including E-comm Reports

Data Analytics & Marketing Focused Content Platform for Shopify Merchants: Analyzify Hub

Check out our free Shopify - Google Tag Manager Course on Youtube
KCC1
Tourist
6 0 7

I was all about ready to reply with a sad face as I dont have access to checkout.liquid and i watched that part of your video.... i feel a bit stupid that I hadnt even realised that we can add custom scripts to the checkout! 🙂 

KCC1
Tourist
6 0 7

Sorry to reply to you on here - have followed the steps and GA4 is all setup and working nicely - thank you so much! I have noticed that there may be a conflict with my UA events? I'm seeing base tag data (page views, session, user etc) but no event data? The UA implementation is handled via shopify, any thoughts on why this might be? TIA!  If you'd rather I contacted you another way, please let me know 🙂

KCC1
Tourist
6 0 7

Just to follow-up on my previous message as I dont want people to think there is a conflict with this solution and running UA at the same time! User error when testing on my UA GA account, I had a couple segments applied that i hadn't noticed...! 🙂

ekuplu
Shopify Partner
43 0 15

I'm glad it is resolved now, and your Shopify & Google Analytics 4 integration is up and running. Also, make sure to check our guide on Recommended GA4 Settings for Shopify merchants. 

Complete Tutorial: Setup GA4 on Shopify including E-comm Reports

Data Analytics & Marketing Focused Content Platform for Shopify Merchants: Analyzify Hub

Check out our free Shopify - Google Tag Manager Course on Youtube
Josh_Ma2
New Member
2 0 0

However, this does not get it into the cart to track conversions in GA4 or Google Ads

Wilobate
Shopify Partner
3 0 1

Just got off a support ticket with them. Still no timeline, and apparently still working on it. I've basically told them they need to get their act together and at least give us a damn timeline. This should have been natively support at least a year ago. They are going to get more people arcing up about this as google is calling people to update to GA4. They have been calling me for the few months and I tell them the same thing, I cant upgrade cause Shopify are being slow lol.

The support agent then told me that they have a tentative release date for custom pixels...
cool, what about the things people have been asking for, for multiple YEARS now... like GA4....

khoff
Excursionist
19 0 9

I am simply astounded by the lack of concern by Shopify on this matter. Google has been announcing this for years. It is not like it is a surprise to anyone. Yet there has been no movement on making this work for Shopify customers. 

Josh_Ma2
New Member
2 0 0
I suggest using Google Tag Manager to install GA4. However; you will not be
able to track purchases without a post-purchase thank you page.
williamoconnor
Shopify Partner
10 1 5

Shopify has just launched Customer Events which allows adding pixels to your store and includes checkout

https://changelog.shopify.com/posts/central-and-secure-customer-behavior-analysis-with-pixels

 

Would anyone know if this is enough to achieve GA4 integration?

mrfrt
Shopify Partner
2 0 0

Hi tested with customer events code and working good maybe you can track to just add code and change gtag id have nice day maybe someone help and we make code better

 

 

// Step 1. Add and initialize your third-party JavaScript pixel (make sure to exclude HTML)

 

// Step 2. Subscribe to customer events using the analytics.subscribe() API
// analytics.subscribe("event_name", event => {
// pixel("track", "event_name", event.data);
// });

// Step 1. Add and initialize your third-party JavaScript pixel (make sure to exclude HTML)

 

// Step 2. Subscribe to customer events using the analytics.subscribe() API
// analytics.subscribe("event_name", event => {
// pixel("track", "event_name", event.data);
// });
// Step 1. Add and initialize your third-party JavaScript pixel (make sure to exclude HTML)

 

// Step 2. Subscribe to customer events using the analytics.subscribe() API
// analytics.subscribe("event_name", event => {
// pixel("track", "event_name", event.data);
// });

const script = document.createElement('script');
script.setAttribute('src', 'https://www.googletagmanager.com/gtag/js?id=YOUR_ID');
script.setAttribute('async', '');
document.head.appendChild(script);

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'YOUR_ID'');

analytics.subscribe("page_viewed", async (event) => {
gtag('event', 'page_view',{page_location:event.context.document.location.href,
page_title:event.context.document.title,
language:event.context.language,
});
});

analytics.subscribe("product_viewed", async (event) => {
gtag('event', 'view_item', {
currency: event.data.productVariant.price.currencyCode,
value: event.data.productVariant.price.amount,
items:[{item_id:event.data.productVariant.id,
item_name:event.data.productVariant.title}]


});
});

analytics.subscribe("search_submitted", async (event) => {

gtag('event', 'search', {
search_term : event.data.searchResult.query
});
});

analytics.subscribe("product_added_to_cart", async (event) => {
gtag('event', 'add_to_cart', {
currency: event.data.cartLine.merchandise.price.currencyCode,
value: event.data.cartLine.merchandise.price.amount,
items:[{item_id:event.data.cartLine.merchandise.product.id,
item_name:event.data.cartLine.merchandise.product.title}]
});
});

analytics.subscribe("payment_info_submitted", async (event) => {
gtag('event', 'add_payment_info');
});

analytics.subscribe("checkout_started", async (event) => {
gtag('event', 'begin_checkout');
});

analytics.subscribe("checkout_completed", async (event) => {

gtag('event', 'purchase', {
transaction_id:event.data.checkout.order.id,
currency: event.data.checkout.currencyCode,
value: event.data.checkout.totalPrice.amount,
items:[
{item_id:event.data.checkout.lineItems[0].variant.sku,
item_name:event.data.checkout.lineItems[0].variant.product.title
}
]
});
});

mrfrt
Shopify Partner
2 0 0
ekuplu
Shopify Partner
43 0 15

Dear Shopify community. 

We're happy to announce that we released a fully working open-source solution for Shopify & Google Analytics 4 integration using Shopify's new feature: Shopify Pixels.  The solution includes major e-commerce events (add-to-cart, product view, checkout steps, purchase and more) with related data (product-level & order-level). 

It is entirely FREE, and you can set it up by yourself easily. I'm adding the Youtube video here. The video covers the following: 
- Intro to Shopify Pixels & Customer Events
- Setting up GA4 on Shopify with Shopify Pixels
- Debugging the setup using GA4's DebugView & Real-time reports
- Cons & Risks of using Shopify Pixels (at the moment) 

Go ahead and integrate with GA4. Enjoy the content, and let me know your comments through this post! 





Complete Tutorial: Setup GA4 on Shopify including E-comm Reports

Data Analytics & Marketing Focused Content Platform for Shopify Merchants: Analyzify Hub

Check out our free Shopify - Google Tag Manager Course on Youtube
tracey23
New Member
1 0 0

I also thought Shopify or the Theme Developers would have upgraded to GA4.  Manually entering this data into any .js file now puts the small shop owners in a position of supporting custom code...without assistance. 

 

What I have found is that Google ends calls and chats when you ask questions.  Our ads using Shopify Marketing were forced to use GA4 about 4 weeks ago and stopped producing sales results while it is "learning".

 

This answer...although it sound simple...could have unwanted consequences at the busiest sales time of year for us.