Google Analytics 4 Setup – Website Traffic Tracking Configuration

Understanding how visitors interact with your website is essential for making informed decisions about content,
design, marketing campaigns, and business strategy. Website analytics platforms provide the data foundation for
these decisions, tracking everything from page views and session duration to conversion paths and user demographics.
Google Analytics has been the dominant web analytics platform for over a decade, and its latest iteration, Google
Analytics 4 (GA4), represents a significant shift in how website traffic data is collected, processed, and reported.
Google Analytics 4 was officially launched in October 2020 and became the standard Google Analytics platform in July
2023, replacing Universal Analytics (UA). Unlike its predecessor, which relied on a session-based data model built
around pageviews, GA4 uses an event-based data model where every user interaction—whether it is a page view, button
click, file download, or video play—is recorded as an event. This fundamental architectural change affects how data
is collected, how reports are structured, and how users interact with the platform. For new website owners setting
up analytics for the first time or existing users transitioning from Universal Analytics, understanding GA4’s
concepts and configuration is increasingly important.
This guide covers the complete process of setting up Google Analytics 4, from creating your property and installing
tracking code to configuring events, conversions, and reports. We will also examine GA4’s key features, reporting
capabilities, privacy considerations, and practical tips for getting the most value from the platform.
I. Understanding Google Analytics 4
What Changed from Universal Analytics
To understand GA4, it helps to know what changed from the previous version. Universal Analytics tracked user
interactions primarily through pageviews organized into sessions. A session represented a group of interactions that
took place within a given time frame, typically ending after 30 minutes of inactivity. While this model worked well
for traditional websites with linear page navigation, it became increasingly inadequate as user behavior evolved to
include app interactions, video consumption, single-page applications, and cross-device journeys.
GA4 addresses these limitations with several key changes. First, the event-based data model treats every interaction
as an event, providing more flexibility in tracking diverse user behaviors. Second, GA4 is designed for
cross-platform measurement, allowing businesses to track users across websites and mobile apps within a single
property. Third, GA4 incorporates machine learning and predictive analytics, including features like predicted
purchase probability and churn probability. Fourth, GA4 is built with privacy considerations in mind, operating
effectively even with reduced cookie availability and offering more granular data retention controls. Fifth, the
reporting interface is significantly different, moving away from pre-built reports toward a more customizable
exploration-based approach.
Key GA4 Concepts
Before setting up GA4, familiarizing yourself with its core concepts will help you configure and use the platform
more effectively. The following terms are fundamental to working with GA4:
| Concept | Description |
|---|---|
| Events | The foundation of all data in GA4. Every user interaction is an event (page_view, click, scroll, etc.) |
| Parameters | Additional context attached to events (page_title, page_location, link_url, etc.) |
| Conversions | Important events marked as conversion goals (purchase, sign_up, form_submit) |
| Users | Identified through device IDs, User-IDs, or Google signals for cross-device tracking |
| Data Streams | Sources of data flowing into a property (web, iOS app, or Android app) |
| Explorations | Custom analytical reports built using drag-and-drop interface for deep analysis |
II. Setting Up a GA4 Property
Step 1: Create a Google Analytics Account
If you do not already have a Google Analytics account, navigate to analytics.google.com and sign in with your Google
account. Click the “Start measuring” button or navigate to the Admin section to create a new account. Enter your
account name (typically your business or organization name), configure data sharing settings according to your
preferences, and click “Next” to proceed to property creation. If you already have a Google Analytics account, you
can add a new GA4 property from the Admin section by clicking “Create Property” under the Property column.
Step 2: Configure Your GA4 Property
When creating a new property, you will need to provide a property name (usually your website name), select your
reporting time zone, and choose your currency. These settings affect how data is processed and displayed in your
reports. The time zone setting determines when daily reporting periods begin and end, while the currency setting is
used for any monetary values tracked in events. After entering these details, click “Next” to proceed through the
business information screens where you can indicate your industry category, business size, and intended use of
Analytics data.
Step 3: Create a Data Stream
After creating the property, you need to set up a data stream to begin collecting data. For a website, select “Web”
as your platform type. Enter your website URL and provide a stream name (this can be your website name). Google
Analytics will generate a Measurement ID in the format G-XXXXXXXXXX. This Measurement ID is what connects your
website to your GA4 property and must be included in your website’s tracking code.
During data stream creation, you will see options for Enhanced Measurement, which is enabled by default. Enhanced
Measurement automatically tracks common user interactions without requiring any additional code. These automatically
tracked events include page views, scrolls (when users reach 90% of page depth), outbound clicks (clicks on links
leading to external domains), site search (when users use your site’s search function), video engagement (for
embedded YouTube videos), and file downloads (when users click links to download files). For most websites, keeping
Enhanced Measurement enabled is recommended as it provides valuable interaction data with no additional setup
effort.
Step 4: Install the Tracking Code
GA4 provides several methods for installing the tracking code on your website. The most common methods include direct
installation of the Global Site Tag (gtag.js) code into your website’s HTML, installation through Google Tag Manager
(GTM), or using platform-specific plugins and integrations.
For direct installation, copy the JavaScript tracking snippet provided in your GA4 data stream settings and paste it
into the <head> section of every page on your website. The code snippet includes your unique
Measurement ID and loads the GA4 tracking library. For websites built on content management systems like WordPress,
Blogger, Wix, or Squarespace, platform-specific integration options may be available that simplify installation to
entering your Measurement ID in a settings field.
Google Tag Manager is the recommended installation method for more complex tracking setups. GTM allows you to manage
all your tracking tags, triggers, and variables from a single interface without modifying your website’s source code
directly. To use GTM with GA4, create a Google Tag Manager account and container, install the GTM container code on
your website, and then configure a GA4 Configuration tag within GTM using your Measurement ID.
Step 5: Verify Data Collection
After installing the tracking code, verify that data is being collected correctly. In your GA4 property, navigate to
Reports > Realtime to see if active users are being tracked. The Realtime report shows users currently on your site,
the pages they are viewing, active events being triggered, and the geographic location of current visitors. It may
take a few minutes after installation for data to begin appearing, so be patient if the report initially shows no
activity.
Another verification method is using the Tag Assistant tool (tagassistant.google.com), which provides a more detailed
debugging interface. Tag Assistant lets you see exactly which events are firing, what parameters are being sent, and
whether there are any configuration errors. Google also offers a Chrome extension called “Google Analytics Debugger”
that outputs detailed GA4 event information to the browser’s developer console.
III. Configuring Events and Conversions
Understanding Event Types in GA4
GA4 categorizes events into four types, each requiring different levels of setup effort. Automatically collected
events are tracked without any configuration, including session_start, first_visit, and page_view (when Enhanced
Measurement is enabled). Enhanced Measurement events are automatically tracked when the feature is enabled and
include scrolls, outbound clicks, site search, video engagement, and file downloads. Recommended events are events
that Google recommends tracking for specific business types, such as login, sign_up, purchase, add_to_cart, and
begin_checkout for e-commerce sites. These require manual implementation but follow Google’s predefined naming
conventions. Custom events are any events you define for tracking interactions specific to your website, such as
newsletter_signup, contact_form_submit, or tool_comparison_click. These require manual implementation through code
or Google Tag Manager.
Setting Up Custom Events
Custom events can be created in two ways: through the GA4 interface or through Google Tag Manager. In the GA4
interface, navigate to Configure > Events and click “Create event.” You can create events based on conditions
applied to existing events. For example, you could create a “contact_page_view” event that fires whenever a
page_view event occurs and the page_location parameter contains “/contact.” Through Google Tag Manager, you have
more flexibility to create events triggered by user interactions like button clicks, form submissions, element
visibility, and time-on-page thresholds. GTM provides a visual interface for configuring triggers, tags, and
variables that define when and how custom events fire.
Marking Events as Conversions
In GA4, any event can be designated as a conversion by toggling the “Mark as conversion” switch in the Configure >
Events section. Unlike Universal Analytics, which used Goals with different configuration types, GA4 simplifies
conversion tracking by treating conversions as flagged events. Common conversions for business websites include form
submissions, newsletter signups, account registrations, purchases, phone call clicks, and chat initiations. By
marking key events as conversions, you can focus your reporting and analysis on the interactions that matter most to
your business objectives.
IV. Navigating GA4 Reports
Standard Reports
GA4’s reporting interface is organized into several main sections. The Reports Snapshot provides a high-level
overview of key metrics including users, new users, average engagement time, and total revenue. The Realtime report
shows current activity on your website. The Life Cycle section contains Acquisition reports (how users find your
site), Engagement reports (how users interact with your content), Monetization reports (revenue and e-commerce
data), and Retention reports (how well you retain users over time). The User section provides Demographics reports
(age, gender, interests) and Tech reports (devices, browsers, operating systems).
Explorations
Explorations are GA4’s most powerful analytical feature, offering custom analysis capabilities that go far beyond
standard reports. The Explore section provides several analysis techniques including Free Form explorations (custom
tables and charts with drag-and-drop dimensions and metrics), Funnel explorations (visualize steps users take toward
a conversion and see where they drop off), Path explorations (see the paths users take through your site), Segment
overlap (compare different user segments), User explorer (examine individual user journeys), and Cohort analysis
(track groups of users over time based on shared characteristics).
Explorations are particularly valuable for answering specific business questions that standard reports cannot
address. For example, you could create a funnel exploration to understand at which step most users abandon a
multi-page form, or a path exploration to see what content users typically view before converting. While
Explorations are more complex to set up than standard reports, they provide significantly deeper analytical
capabilities.
V. Privacy and Data Settings
Data Retention
GA4 provides configurable data retention settings that determine how long user-level and event-level data is stored.
By default, data retention is set to 2 months, but it can be extended to 14 months. It is important to note that
this setting primarily affects Exploration reports and does not impact standard aggregated reports, which continue
to display historical data regardless of the retention setting. For most websites, extending data retention to 14
months is recommended to enable more meaningful year-over-year analysis in Explorations.
Consent Mode and Privacy Controls
GA4 is designed to work with consent management platforms (CMPs) and supports Google’s Consent Mode, which adjusts
data collection behavior based on user consent choices. When a user declines analytics cookies, Consent Mode allows
GA4 to send cookieless pings that provide aggregate, anonymized data without identifying individual users. This
approach helps maintain some level of analytics coverage even when strict consent requirements apply, such as under
GDPR in Europe or similar privacy regulations in other jurisdictions. GA4 also provides options for IP anonymization
(which is applied by default), data deletion requests, and the ability to disable data collection for specific
geographic regions.
VI. Integration with Other Google Products
Key Integrations
GA4 integrates with several other Google products, creating a connected analytics and marketing ecosystem. Google Ads
integration allows you to import GA4 conversion data and audiences into your advertising campaigns, improving
targeting and bid optimization. Google Search Console integration brings search performance data (impressions,
clicks, average position) into your GA4 reports, providing a more complete picture of organic search performance.
BigQuery integration, available on all GA4 properties (including free accounts), enables you to export raw
event-level data to Google’s cloud data warehouse for advanced analysis using SQL queries. Google Looker Studio
(formerly Data Studio) integration allows you to create custom dashboards and visualizations using GA4 data.
VII. Strengths and Limitations
Strengths
- Free to use with generous data collection limits for most websites
- Event-based data model provides more flexible and accurate tracking of diverse user interactions
- Cross-platform tracking enables unified measurement across websites and mobile apps
- Machine learning features provide predictive analytics and automated insights
- Free BigQuery export enables advanced data analysis and custom reporting
- Built-in privacy controls and Consent Mode support for regulatory compliance
- Explorations provide deep analytical capabilities beyond standard reports
- Tight integration with Google Ads, Search Console, and other Google products
- Enhanced Measurement reduces the need for custom tracking code for common events
Limitations
- Significant learning curve for users transitioning from Universal Analytics
- Reporting interface may feel unfamiliar and less intuitive initially compared to UA
- Data thresholds and sampling can affect report accuracy, especially for smaller websites
- Limited data retention (maximum 14 months for Exploration data)
- Some reports from Universal Analytics have no direct equivalent in GA4
- Real-time data processing means reports may show slight delays compared to real-time tools
- Advanced setup (custom events, enhanced e-commerce) still requires technical knowledge or Google Tag Manager
- Data accuracy can be affected by ad blockers and privacy-focused browsers
VIII. Alternatives to Consider
While Google Analytics 4 is the most widely used web analytics platform, several alternatives are worth evaluating
depending on your specific needs and concerns. Matomo (formerly Piwik) is an open-source analytics platform that can
be self-hosted, giving you complete control over your data—a significant advantage for organizations with strict
data privacy requirements. Plausible Analytics and Fathom Analytics are privacy-focused, lightweight alternatives
that do not use cookies and comply with GDPR without requiring consent banners, though they offer less granular data
than GA4. Adobe Analytics is an enterprise-level platform with more advanced segmentation and attribution modeling
capabilities, but at a significantly higher cost. Mixpanel and Amplitude specialize in product analytics with strong
event-based tracking and funnel analysis, making them popular with SaaS companies and app developers who need
detailed user behavior insights.
IX. Conclusion
Google Analytics 4 represents a significant evolution in web analytics, transitioning from a session-based pageview
model to a more flexible event-based approach that better reflects modern user behavior. While the transition from
Universal Analytics requires adjustment, GA4’s capabilities—including cross-platform tracking, machine learning
insights, enhanced privacy controls, and free BigQuery access—make it a powerful tool for understanding website
performance and user behavior.
Setting up GA4 correctly from the beginning is important for ensuring accurate data collection and meaningful
reporting. Taking the time to configure Enhanced Measurement settings, set up relevant custom events, mark key
conversion actions, and explore the platform’s reporting and Exploration features will help you extract maximum
value from the platform. For most website owners, GA4 provides a comprehensive, free analytics solution that, once
properly configured, delivers the insights needed to make data-driven decisions about content strategy, user
experience, and marketing effectiveness.


