Google Analytics 4 in Shopify using Native Integration
by ShahzadaAliHassan - 30th October 2023Introduction
In this blog, we are going to explore how you can configure Google Analytics 4 (GA4) for your Shopify store using native integration. By the end, you'll understand how to track e-commerce events like "view item", "add to cart", and "purchase" to gain insights into user behavior.
Google Analytics provides us invaluable insights into our store's performance and customer behavior without the need for deep technical knowledge. It's a must-have for Shopify store owners who aim to optimize their business operations.
Two Main Approaches to Shopify Analytics Setup
There are two primary methods to achieve this:
- Utilizing Google's channel integrated with Shopify, providing a holistic solution to most tracking needs (this Blog).
- A more custom and robust approach using Google Tag Manager's web and server containers (will be covered in future blogs).
In this guide, we'll focus on the first option, employing Google and YouTube sales channels for Shopify to monitor events on GA4.
Advantages and Drawbacks of Google's Built-in Channel
This process is fairly straightforward. However, one significant drawback is its inability to track all traffic. Estimates show tracking rates of around 60% to 90%. Factors like ad blockers, iOS's ITP restrictions, and EU data protection regulations hinder complete tracking.The native integration does not track the following events by default either:
- View Item List (view_item_list)
- View Cart (view_cart)
- Add Shipping Info (add_shipping_info)
The first two missing events can be added via google tag manager, and the blogs can be found on the website. However, to improve the accuracy of tracking, shifting from Google's built-in channel to Google Tag Manager is the solution, demanding more resources (we'll tackle that in future blogs).
There are also issues with Upsell Tracking that are discussed later in this blog.
Tips: Remember that while the built-in configurations are great for beginners, a more custom setup might be required for advanced tracking needs.
Prerequisites
Before starting, ensure:
- You have a Shopify store.
- A Google Analytics 4 account is set up.
Creating a Google Analytics 4 Account
If you're new to GA4:
- Visit Google Analytics
- Follow the account creation process, naming your property (e.g., "TrackingAcademy").
- Enter your website details and proceed through the setup.
Data Stream Setup
A data stream is a pipeline transporting data from Shopify to GA4. Here's how to set one up:
- Under "Property" in GA4, select "Data Streams".
- Choose the appropriate stream type (web, for Shopify).
- Enter website details and create the stream.
Integrating Google and YouTube Channels in Shopify
- In your Shopify dashboard, navigate to "Sales Channels".
- Search and select "Google and YouTube".
- Install the sales channel, then authorize the app for complete integration.
- Connect the appropriate GA4 property.
To validate, visit your Shopify store. You can also use Chrome extensions to check for Global Site Tags, which Google uses to dispatch various tags.
Testing the Integration
Perform actions like viewing items, adding to cart, and starting checkout. Then, return to GA4 to ensure these events are being logged correctly.
Tips: Regularly test and verify that all events are being tracked correctly to ensure the accuracy of data.
Making a Test Purchase
- Add an item to your cart and proceed to checkout.
- Use dummy user data to simulate the purchase process.
- Return to GA4 to verify that events like "add payment info" and "purchase" are being captured.
Note: Some events, like "view_item_list", "view_cart" and "add_shipping_info", might not be enabled by default.
Upsell Tracking
Another issue related to native integration is Upsell Tracking, the default channel, does not track the conversions made on the second upsell. GA4 only records the first conversion event that fires on the Purchase flow, it deduplicates every other purchase event since they all have the same transaction_id parameter. There is a solution, however that will be discussed in the later blogs. You can refer to this Upsell Tags Page in future, for updates.
Conclusion
Choosing the right configuration and ensuring that all events are correctly tracked is vital for getting accurate analytics data. While Shopify's built-in tools and the Google and YouTube sales channels offer a simplified way to connect with Google Analytics, it's important to note their limitations. For businesses that require more detailed tracking or those operating in regions with strict user privacy regulations, additional configurations or tools may be necessary.
Tips: Consider integrating other tools or platforms as your e-commerce business grows to gain deeper insights into user behavior and sales trends.
By following these instructions, users can make data-driven decisions that can positively influence their e-commerce strategies. Remember to regularly review and refine your configurations to keep up with evolving business needs and digital landscapes.