The Ultimate Guide to Setting Up GA4 for Your Online Store

GA4 replaced Universal Analytics with an event-based model. Follow this guide to set it up correctly for your online store, the first time. Follow it to.

Yuvraj RauljiYuvraj RauljiRaulji Technologies Jan 17, 2025 5 min read Updated Jun 1, 2026 Intermediate
Quick Answer

GA4 replaced Universal Analytics with an event-based model. Follow this guide to set it up correctly for your online store, the first time. Follow it to.

On this page

Google Analytics 4 (GA4) is an essential tool for any e-commerce business looking to track user behavior and optimize performance. GA4 offers a range of advanced features that provide detailed insights into your customer journey, from initial website visits to completed purchases.
In this comprehensive guide, we’ll walk you through the entire process of setting up GA4 for your online store, so you can start capturing valuable data and use it to boost your business.

Why GA4 Is a Game-Changer for E-Commerce

Google Analytics 4 is the future of analytics, offering a new event-based data model and machine learning capabilities. Unlike Universal Analytics, GA4 enables you to track users across multiple devices, provides more flexible reporting, and allows you to focus on meaningful interactions – like product views, add-to-cart events, and purchases – rather than just page views.

Setting up GA4 correctly is crucial to unlock its full potential. Follow the steps below to get started.

Step 1: Create a GA4 Property

The first step in setting up GA4 for your online store is to create a new GA4 property in your Google Analytics account. If you already have a Universal Analytics property, GA4 can run alongside it to allow for a seamless transition.

  1. Log in to your Google Analytics account.
  2. Click on Admin at the bottom left of the screen.
  3. Under the Account column, select your account, then click on + Create Property.
  4. Follow the prompts to set up your GA4 property.

Step 2: Add the GA4 Tracking Code to Your Website

Once your GA4 property is created, you need to add the tracking code to your website. This code tracks user activity and sends data back to GA4 for analysis.

  1. In the GA4 property settings, click on Data Streams.
  2. Select Web and enter your website URL.
  3. Copy the provided Global Site Tag(gtag.js) and paste it into the<head> section of every page on your website.

If you’re using a CMS (like WordPress, Shopify, or WooCommerce), you can typically add the GA4 tracking code via the site’s settings or a plugin.

Step 3: Set Up Enhanced E-Commerce Tracking

GA4 offers robust e-commerce tracking that allows you to capture specific user interactions, such as product views, add-to-cart actions, and completed purchases. To get started with enhanced e-commerce tracking:

  1. Go to Admin > Data Streams > Select your data stream.
  2. Under Enhanced Measurement, toggle on the features you want to track, such as page views, scrolls, and outbound clicks.
  3. For more detailed e-commerce tracking (like product impressions and purchases), implement additional tracking code on your website using Google Tag Manager or directly on your site.

Tip: If you’re using a platform like Shopify or WooCommerce, many of these enhanced e-commerce features can be easily enabled with pre-configured integrations.

Step 4: Set Up Conversion Goals

GA4 allows you to track conversions based on custom events. Common conversion goals for e-commerce stores include purchases, form submissions, and product views. To set up a conversion goal:

  1. Go to Events in your GA4 property.
  2. Create a new event or select an existing one, such as a “purchase” or “add_to_cart” event.
  3. Mark this event as a conversion by toggling the Mark as conversion option.

Tip:You can track additional conversion goals such as newsletter sign-ups, account creations, or any other action that leads to revenue generation.

Step 5: Set Up User Properties for Advanced Segmentation

GA4 allows you to define user properties to segment your audience. These properties could include demographics, purchase history, or customer loyalty status. This segmentation will help you understand your audience better and tailor your marketing efforts.

  1. Go to Admin > Property Settings.
  2. Scroll to the Custom Definitions section.
  3. Add custom user properties that are relevant to your business, such as “VIP customer” or “First-time visitor.”

Tip: Create user segments based on behavior, such as users who viewed specific products or abandoned their carts, for targeted remarketing.

To maximize the power of GA4, link your GA4 property with Google Ads and other platforms like Google Search Console. This integration allows you to monitor your ad campaigns, track user interactions, and optimize your ads based on performance.

  1. In your GA4 property, go to Admin > Product Linking.
  2. Select Google Ads and follow the prompts to link your Google Ads account.
  3. Set up your goals and conversions in Google Ads to track ROI.

Tip: Linking your Google Ads account to GA4 ensures that you can track the full customer journey, from ad interaction to purchase.

Step 7: Analyze Your Data with Custom Reports

GA4 offers advanced reporting features that allow you to create custom reports and dashboards. Some key reports for e-commerce businesses include:

  • E-Commerce Purchases: Track the total revenue, number of transactions, and average order value.
  • Product Performance: Understand which products are performing best in terms of views, add-to-carts, and purchases.
  • Funnel Analysis: Visualize how users move through your sales funnel, from product views to checkout.

To create custom reports:

  1. Go to Explore > Explorations.
  2. Choose from different report types (e.g., Free Form, Funnel Exploration, Path Exploration).
  3. Customize the report with the metrics and dimensions most important to your e-commerce store.

Conclusion

Setting up GA4 for your online store is a critical step in unlocking the full potential of your e-commerce business. By correctly implementing GA4, you’ll gain valuable insights into your customers’ behavior, identify opportunities for improvement, and optimize your store for increased conversions.

Start following this guide today to set up GA4, track key e-commerce metrics, and leverage the power of data to grow your online business!

Frequently asked

Frequently Asked Questions

Answers to the questions we hear most often.

Can we still run GA4 alongside a Universal Analytics property?

No, that option has gone. Standard Universal Analytics properties stopped processing new data on 1 July 2023, and Google began deleting Universal Analytics data from 1 July 2024, so there is no historical property left to run in parallel or export from. Any setup guide describing a transition period where both collect data simultaneously predates that shutdown. If you never exported your Universal Analytics history before deletion, it is gone, and GA4 history begins from whenever your property was created.

Where is the Enhanced Ecommerce setting in Data Streams?

There isn't one, and this is the most common error in GA4 setup guides. Enhanced Ecommerce belonged to Universal Analytics. In GA4 there is no admin toggle that turns ecommerce tracking on. Reports populate only when your site sends the reserved events, principally view_item, add_to_cart, begin_checkout and purchase, each with a properly structured items array. If you have followed a guide to a settings screen that does not exist, the tagging work is still ahead of you rather than behind you.

Is it still called the Global Site Tag?

It is now the Google tag, and the naming changed along with how it works. A single Google tag can serve GA4 and Google Ads, configured through the tag settings rather than by pasting several separate snippets. Functionally gtag.js is still the underlying library, so old instructions are not wrong so much as outdated in vocabulary. Place it in the head of every page, or install it through your platform integration or Tag Manager, and verify with Realtime that it is actually firing sitewide.

Should we install GA4 with a plugin, Tag Manager, or hardcoded?

For most stores, start with the platform's native GA4 integration if it is well maintained, since its ecommerce events are usually more reliable than a hand built container and survive theme updates. Add Google Tag Manager when you need custom events, extra parameters, consent handling or third party tags managed without a developer release. Hardcoding is the least maintainable option. Whatever you choose, make sure only one system sends each ecommerce event, because duplicate purchase events are the most common cause of inflated revenue.

What must the purchase event contain to be correct?

At minimum a unique transaction_id, the order value, the currency code, and an items array where each entry carries item_id, item_name, price and quantity. Adding tax, shipping and coupon improves reporting accuracy. The transaction_id matters most, because GA4 uses it to deduplicate, which protects you when a confirmation page is refreshed or two tracking systems both fire. Verify all of this on a real test order in DebugView rather than trusting that the integration is doing it correctly.

Do we need Consent Mode?

If you have visitors in the EEA or the UK, yes. Since March 2024 Google has required Consent Mode v2 signals for advertisers using Google's audience and remarketing features with traffic from those regions, and your consent banner must transmit the ad_storage, analytics_storage, ad_user_data and ad_personalization parameters. Implemented properly, Consent Mode still allows modelled reporting when users decline. Implemented incorrectly, you lose both the data and the ability to build audiences, so test it explicitly rather than assuming your banner handles it.

What are the first settings to change after creating a property?

Data retention, from the default two months to 14 months, which is the maximum on standard properties and is not applied retroactively. Then link the BigQuery export, also not retroactive, so every day of delay costs history permanently. Then set your reporting time zone and currency correctly, because changing them later does not restate past data. Then define internal traffic filters so your own team's sessions are excluded. Four settings, ten minutes, and they are the ones most properties never get right.

How do we verify the setup actually works?

Complete a real end to end test purchase with DebugView open. Watch view_item, add_to_cart, begin_checkout and purchase appear in order, then open the purchase event and inspect its parameters and items array. Repeat the whole exercise on a mobile device, since mobile checkout often uses a different template and breaks separately. Finally check that the event fired once, not twice. Fifteen minutes of this prevents a quarter of decisions made against wrong numbers, which is the actual cost of a bad setup.

Which events should we mark as key events?

Only the ones you would act on, which for most stores means purchase and perhaps begin_checkout or a lead form submission. Note that GA4 renamed conversions to key events in March 2024, so older guides describe marking conversions instead. The temptation is to mark ten events so the dashboard looks busy, but every additional key event dilutes the reports where it matters and makes channel comparison meaningless. A store with one clear key event has better reporting than one with eight.

Should we exclude internal and developer traffic?

Yes, and it is frequently skipped. Define internal traffic by IP in the data stream settings, then activate the corresponding data filter, which starts in testing mode and must be switched to active to actually exclude anything. Leaving it in testing mode is a common oversight. On a lower traffic store, staff and agency sessions can distort engagement and conversion figures noticeably, and developer test orders will quietly inflate revenue unless they are filtered or use a separate test property.

Do we need a separate property for testing?

A separate test data stream or property is worth having if you deploy frequently or work with an agency, because it lets you validate tagging changes without polluting production data. The lighter alternative, adequate for smaller teams, is DebugView combined with strict internal traffic filtering, since DebugView isolates your own session while you test. What you should avoid is running experiments directly against production with no filtering, then trying to identify and exclude the noise afterwards. Whichever route you take, decide it before launch, because retrofitting a clean test environment onto a property already full of mixed data is considerably more work.

How long until GA4 data is usable?

Realtime and DebugView show events immediately, which is what you use to verify the setup. Standard reports typically populate within 24 to 48 hours, so do not conclude the installation failed on day one. Meaningful analysis needs enough volume to see patterns rather than noise, which for most stores means a few weeks. Predictive features need far more, requiring at least 1,000 returning users who triggered the condition and 1,000 who did not within the qualifying window. Set expectations with stakeholders on day one, since the most common cause of teams abandoning GA4 is judging it during the window when it is still filling up.

Yuvraj Raulji

Yuvraj Raulji

Verified expert

Founder

Founder of Raulji Technologies with expertise in enterprise eCommerce solutions. Specialized in Magento 2, Shopify, and headless commerce architecture. Driving growth through CRO, SEO, and performance engineering. Helping businesses turn technology into measurable revenue.
Share
Ready When You Are

Turn your store into a revenue machine

Our team has helped 150+ brands scale with Magento, Shopify and AI-powered solutions.

Get a Free Growth Plan
Stay in the loop

Get our latest insights by email

Practical eCommerce, Magento, Shopify and AI growth strategies. No spam, unsubscribe any time.

By subscribing you agree to our Privacy Policy.

Book Free Consultation

We're Trusted By Businesses Across The Globe

Discover why 100+ global brands choose Raulji Technologies for AI-driven eCommerce, web development, and digital transformation, scaling their digital growth with innovation, performance, and trust.

100+
Brands Served
150+
Projects Delivered
12+
Years Experience
4.9
Average Rating
Clutch 5.0

Clutch Verified Profile

Rated 5.0 by verified clients on Clutch for Magento, Shopify, and AI-driven digital transformation.

View Clutch Profile
DesignRush 5.0

DesignRush Verified Profile

Listed and reviewed on DesignRush as a top eCommerce and web development agency.

View DesignRush Profile
Google 5.0

Google Verified Profile

Reviewed by clients on Google across India, the Gulf, and worldwide for delivery and support.

Read Google Reviews