If you want to learn how to use GA4 for Shopify, you’ve come to the right place. But before we get into that, we should review a few typical Shopify store questions.
These questions include “How many sales did I get?” and “What is the average order value?” However, one important question that seems not enough people are asking is how we got those sales.
Knowing this can help you improve your marketing so that you can reliably grow your Shopify store’s revenue. With the right setup, you can ask the questions like how many sales you got, but you can also ask things like “how many users added this item to their cart?” and “How many users need an item?”
3 Ways to Connect GA4 to Shopify
When connecting your GA4 e-commerce with your Shopify store, things can get a little confusing, so that’s probably a good place to start. For this process, you will need access to Google Tag Manager (or GTM for short). Below, we list three options regarding how to connect GA4 and Shopify, as well as the pros and cons of each option.
Custom code solution has the main benefit of potentially being free depending on the in-house development skills available. You can also customize it as needed based on your team’s skills. On the downside, this option does require a developer, custom code, and extra time to set up.
An example of the kind of code that could be used in this process is a GitHub open-source Shopify GA4 Ecom data layer setup guide. Using the guide will pre-populate the data layer in GTM with the information required for Ecom events.
In case you don’t know, a data layer essentially functions as a file cabinet that holds the information you need at a specific time in GTM. You’ll need to set up your own tags and triggers to pull said information out of the data layer and send it to GA4. Implementing a custom code solution is highly recommended to test this every few weeks to ensure that your customized code solutions will still work if there are any changes in Shopify.
Currently, the Google Channel App is free for everyone and has the added benefit of a quick and easy setup process. That being said, the setup does require you to have an active Google Ads account. You can download the Google Channel App by going to apps.shopify.com/google.
After the app has been downloaded, it will populate the data layer with the required information for the Ecom event. Just like with the Custom Code Solution, you will still need to set up your own tags, triggers, and variables to grab the information and send it to GA4.
The third option is to use a paid tool, like Elevar. As the title suggests, this is the only option of the three that is not available for free. All of the experts we’ve spoken to recommend using a paid tool, and many mentioned Elevar specifically.
Tools like Elevar have a faster implementation, which will pre-populate the data layer, just like the previous two options. Unlike the other two options, though, Elevar provides you with GTM templates and tracking for email signups. They also maintain their own code base in case of any changes in Shopify.
Below, we’ll go over how to set up Elevar, but before we get into that, there are a few things you’ll need to ensure you have access to. You will need access to the Google Tag Manager container, Shopify Online Store themes and preferences, and checkout settings of your Shopify store. Downloading the Shopify theme file search by EZFY is also an excellent idea.
Once you have signed up for Elevar (any tier will do), you need to hook it up to a Google Account. The Google Account you attach to your Shopify should be an account with access to the Google Tag Manager and Google Analytics 4.
Install Your Data Source
Once you have connected the store and the analytics accounts, you’ll need to install your data source. To do this:
- Start by entering your Google Tag Manager container.
- From there, click on your container ID.
- Find and copy your GTM from there.
- Go back to Elevar and paste that into the box prompting you for your GTM container.
You should be able to see a little arrow below that says event breakdown. A series of checkboxes will appear if you click the arrow, and it’s best if you leave them all on. These can measure everything you need for measuring results and how questions. Go ahead and hit save.
The next step is to set up “consents”. You don’t necessarily need to have any consents, but if you do have any, you should read up on Elevar’s consent documentation. They do a great job of explaining.
Set up Your Store
Now it’s time to set up your store. You will want to remove any preexisting GTM scripts from it to prevent duplicate tracking. Head over to the preferences of your Shopify store and scroll down to Google Analytics. If there are any scripts already there, specifically GA4 or Tag Manager scripts, you will need to remove them.
Next, head over to online store>themes. Once you’re there, you’ll click on the three dots next to the customize button. And hit edit code. This is where the plugging mentioned above will help a lot. You can just come in here, past your GTM container, and hit search.
This will cause it to highlight the files with your GTM container thread in them. You’ll want to remove your GTM container anywhere you find it because you don’t want it installed twice on your Shopify. Head back to Elevar now.
Once you’re in Elevar, find the “configure checkout” area. This step will vary greatly depending on whether you are or aren’t a Shopify Plus store. If you are, you should click the link that says “view guide” to walk you through the steps they provide to set up an Elevar Plus Shopify store. For now, we’re going to be focusing on non-plus Shopify stores.
Click the purple “copy to clipboard” button, then head to the Shopify store settings. Click on Checkout and scroll down to the order status page section. You want to do this because you can’t track the checkout step where the user goes to the checkout since that’s on the Shopify URL. However, you want to add scripts to the final page to track where the traffic came from after they complete the final purchase. Paste in the script Elevar provided and hit save.
Back to Elevar
Return to Elevar yet again. The final step is to install Elevar into your store if you haven’t already. If you click on reinstall, you’ll get a pop-up message warning you. You should notify developers if you have them that you’re installing this. If you don’t have developers, go ahead and hit install.
Your data layer is now configured, so we need to determine where it will send the information. Obviously, we want to send it to GA4 for this article. To configure this, you’ll need to start by configuring the events you want Elevar to track and send to GA4. You can probably keep all of the checkboxes on. Hit save.
Then go to the consent page. After that, you’ll need to get your GA4 ID again. Go to GA4 and click on Admin>Data Streams. Click on your data stream. There you’ll see your measurement ID. Click the copy button and paste it into Elevar. Remember to take off the extra G.
Web Container Setup
Finally, go to the Web Container Setup. Here, Elevar will give you a pre-built web tag template. This is basically your entire GTM container, ready to go. Go ahead and hit download, then return to the GTM page. Go to Admin>Import Container. Click choose file. The file name will start with destination GA4 web.
Choose a new workspace and name it whatever you want. You can add a description if you want, but it’s not necessary. Select merge so that you don’t accidentally override anything. Hit confirm. This will import all the containers, tags, and triggers into your Google Tag Manager.
Elevar will then show you how to update anything they have. When an update is available, there will be a gray banner at the top of the page. If you see this, click on view update. You’ll find an Elevar template, so go ahead and complete the update.
Preview the Results
After all the event tracking has been added to GTM, you’ll want to preview it and see how it works. Do this by clicking on the preview. Paste in your Shopify store URL and hit connect. It should take you to your store page. Check and make sure that your tags have loaded correctly. What you’re looking for is DL_UserData. This indicates that Elevar is already running and has populated the data layer with information.
You can test it further by going through some typical Ecommerce events on your Shopify store. View one of your items and check on GTM again. You should see an option to view items in the data layer. The nice thing about Elevar is that they use their UA setup to simultaneously fire a GA4 item view while sending all the information to GA4.
If you go to GA4, you can see what this information looks like on that end. Go to GA4>configuration>debug. You should be able to see yourself and the view item event. If you click on items, you should be able to see the test product you just clicked on and all the items.
Try adding the product to your cart to test it a bit more. Go back to GTM and see what shows. You should see one saying that you added the product to your cart. All of this should also be in the data layer. You can further test things like shipping, discount codes, and shipping/complete orders. If you are a non-plus store, the tag assistant may disconnect here, but it will turn blue when you make it to the completed purchase page.
All the information should be there, meaning that you’ve set up everything and it’s all working correctly.