🛠️ Step-by-Step Guide · Analytics · GA4 & Event Tracking

Google Analytics 4 (GA4): How to Set Up, Track Events & Analyse Data

Google Analytics 4 (GA4) is Google's current analytics platform, built on an event-based data model that tracks user interactions across websites, iOS apps, and Android apps within a single property. Unlike the now-retired Universal Analytics, GA4 treats every interaction — a pageview, a scroll, a button click, a purchase — as an event with attached parameters, giving you far richer, more flexible data about how people actually use your product.

This guide answers every major "how to" question about GA4: from creating your first property and installing the tracking code, to setting up advanced event tracking, linking third-party tools, managing consent, and exporting raw data to BigQuery. Each section explains both the steps and the reasoning behind them so you can make informed decisions for your specific setup.

Key insight: GA4 is not a direct replacement for Universal Analytics — it is a fundamentally different product. Understanding its event-based architecture from the outset is the single most important step to getting accurate, useful data.

How do you create a GA4 property?

A GA4 property is the container in your Google Analytics account that holds all the data collected from your website or app. Each property has its own Measurement ID and can include multiple data streams (web, iOS, Android).

To create a new GA4 property, follow these steps:

  1. Go to analytics.google.com and sign in with your Google account.
  2. Click Admin (the gear icon) in the bottom-left corner.
  3. Under the Account column, either select an existing account or click Create Account to start fresh.
  4. Under the Property column, click Create Property.
  5. Enter a property name (e.g. your website name), select your reporting time zone and currency, then click Next.
  6. Describe your business category and size, then select your primary business objective (e.g. "Get baseline reports", "Examine user behaviour").
  7. Click Create and accept the Terms of Service.
  8. Select the platform for your first data stream: Web, iOS, or Android.

Once created, your property will be assigned a Measurement ID in the format G-XXXXXXXXXX. This ID is what connects your website or app to the property.

How do you install GA4 directly on a website?

If you are not using Google Tag Manager, you can add GA4 tracking directly by placing the Google tag (gtag.js) snippet in the <head> section of every page on your site.

  1. In GA4, go to Admin > Data Streams and select your web stream.
  2. Under Google tag, click View tag instructions.
  3. Copy the entire tag snippet provided — it will look similar to the example below.
  4. Paste it as high as possible in the <head> section of every HTML page on your site.
  5. Verify installation by opening your site, waiting 1–2 minutes, then checking the Realtime report in GA4 for active users.
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Replace G-XXXXXXXXXX with your actual Measurement ID. For CMS platforms like WordPress, plugins such as Site Kit by Google or MonsterInsights can handle this installation without touching code.

How do you set up GA4 with Google Tag Manager?

Google Tag Manager (GTM) is the recommended installation method for most websites because it centralises all tracking in one place and allows non-developers to deploy and modify tags without touching site code.

  1. In Google Tag Manager, open your container and go to Tags > New.
  2. Click Tag Configuration and choose Google Tag from the tag type list.
  3. Enter your GA4 Measurement ID (G-XXXXXXXXXX) in the Tag ID field.
  4. Under Triggering, select Initialization — All Pages. Using the Initialization trigger ensures the GA4 tag fires before any other tags, which is critical for accurate session attribution.
  5. Name the tag (e.g. "GA4 — Google Tag") and click Save.
  6. Click Preview to enter Debug Mode. Open your website in the new browser window that appears and confirm the Google Tag fires on page load.
  7. Return to GTM, click Submit, add a version name and description, then click Publish.
Important: Never place the GA4 gtag.js snippet directly on your site if you are also using GTM. Doing so will result in duplicate data — each pageview recorded twice, inflating all your metrics.

How do you enable Enhanced Measurement in GA4?

Enhanced Measurement is a GA4 feature that automatically tracks a set of common user interactions — without any additional code. It is one of GA4's most significant advantages over Universal Analytics.

Enhanced Measurement automatically collects the following events when enabled:

Event Name What It Tracks Default Status
page_view Every page load or browser history change On
scroll First time a user reaches 90% of page depth On
click All outbound link clicks (leaving your domain) On
view_search_results Site search queries using your internal search On
video_start / video_progress / video_complete Embedded YouTube video interactions On
file_download Clicks on downloadable files (PDF, DOCX, ZIP, etc.) On
form_start / form_submit Form interactions (where forms are accessible to the tag) On

To review or toggle these events, go to Admin > Data Streams, select your web stream, and click the toggle next to Enhanced measurement. Click the settings gear icon to enable or disable individual events within the set.

How do you track custom events in GA4?

GA4's event-based model means virtually any user interaction can be tracked as a custom event. There are three methods, depending on your technical setup.

Method 1: Create events inside GA4 (no-code)

GA4 allows you to create new events based on existing ones directly in the interface. Go to Admin > Events > Create Event. You can define a new event name and set conditions based on existing event parameters (e.g. create a blog_scroll_complete event that fires when event_name equals scroll AND page_location contains /blog/).

Method 2: Send events via gtag.js

If GA4 is installed directly (without GTM), call gtag('event', ...) wherever the interaction occurs in your JavaScript:

gtag('event', 'newsletter_signup', {
  'method': 'footer_form',
  'page_location': window.location.href
});

Method 3: Use Google Tag Manager triggers

In GTM, create a new tag of type Google Analytics: GA4 Event, enter your event name and any parameters, and set the trigger to the specific user interaction (e.g. a button click, a form submission, an element becoming visible). This is the most flexible and maintainable approach for complex tracking requirements.

How do you set up key events (conversions) in GA4?

Key events are events you designate as business-critical conversions — purchases, sign-ups, lead form submissions, demo requests. They appear prominently in reports and can be used as conversion goals in Google Ads campaigns.

  1. Go to Admin > Events. You will see all events GA4 has recorded in the last 28 days.
  2. Find the event you want to designate as a key event (e.g. form_submit, purchase).
  3. Toggle the Mark as key event switch to the right of that event name.
  4. Alternatively, click New key event to manually enter the name of a custom event you intend to track.

Key events are retroactively applied to all historical data in standard reports. However, they will not appear in reports until the event has actually been recorded at least once. Confirm the event is firing correctly using DebugView or the Realtime report before marking it as a key event.

Tip: The GA4 purchase event is automatically treated as a key event when e-commerce tracking is correctly implemented. You do not need to manually mark it.

How do you filter internal traffic in GA4?

Internal traffic — visits from your own team, developers, or office network — inflates your user and session counts and skews engagement metrics. Filtering it out ensures your reports reflect only genuine users.

  1. Go to Admin > Data Streams, select your web stream, and scroll to More tagging settings.
  2. Click Define internal traffic, then click Create.
  3. Enter a rule name (e.g. "Office IP"), set the match type to IP address equals, and enter your office's public IP address. You can add multiple IP ranges.
  4. Optionally, change the traffic_type parameter value from the default internal to a custom label.
  5. Now go to Admin > Data Filters and create a new filter of type Internal Traffic.
  6. Set the filter state to Active (use Testing mode first to verify it works without permanently excluding data).

Note that IP-based filtering does not work for remote workers or mobile users on cellular networks. For individuals, a better solution is to use the Google Analytics Opt-Out browser extension, which prevents the GA4 tag from firing entirely for that browser session.

How do you set up custom dimensions and metrics in GA4?

GA4 automatically captures a set of standard event parameters (like page_title, session_source, event_count), but custom parameters you send with your own events are invisible in reports until you register them as custom dimensions or metrics.

  1. Go to Admin > Custom Definitions, then click Create Custom Dimension.
  2. Enter a human-readable Dimension Name (e.g. "Article Category").
  3. Select the Scope: Event for parameters sent with each event, or User for properties that describe a user across sessions.
  4. In the Event parameter field, type the exact parameter name as it appears in your event code (e.g. article_category).
  5. Click Save. The dimension will begin populating from this point forward — it does not backfill historical data.

GA4 supports up to 50 custom event-scoped dimensions, 25 user-scoped dimensions, and 50 custom metrics per property on the free tier. Plan your parameter taxonomy carefully before implementation to avoid exhausting these limits.

How do you create audiences in GA4?

Audiences are segments of users who share specific attributes or behaviours. In GA4 they serve two functions: enabling audience-based analysis in reports, and powering remarketing campaigns in Google Ads.

  1. Go to Admin > Audiences and click New Audience.
  2. Choose a starting point: use a Suggested audience template (e.g. "Purchasers", "7-day inactive users"), build from scratch, or use a predictive audience (requires sufficient conversion data).
  3. Define your audience conditions using the dimension and metric builder. You can combine conditions using AND/OR logic and add sequences to target users who performed actions in a specific order.
  4. Set the Membership duration — how long a user remains in the audience after last meeting the criteria (up to 540 days).
  5. Name the audience and click Save.

GA4's predictive audiences (e.g. "Likely 7-day purchasers", "Likely 7-day churning users") are powered by machine learning and appear automatically once your property accumulates enough data — typically at least 1,000 returning purchasers and non-purchasers each within 28 days.

How do you use Explore reports in GA4?

The Explore section of GA4 is a flexible workspace for ad-hoc analysis that goes well beyond standard reports. It includes several report templates — Free Form, Funnel Exploration, Path Exploration, Segment Overlap, User Lifetime, and Cohort — each answering different types of business questions.

To create a Free Form Explore report:

  1. Click Explore in the left navigation, then select Free Form.
  2. In the Variables panel, click the + next to Dimensions and Metrics to add the data points you want to analyse.
  3. Drag dimensions to the Rows or Columns fields in the Settings panel, and drag metrics to the Values field.
  4. Apply segments from the Variables panel to compare different user groups side by side.
  5. Use the Filters field to restrict the report to specific events, pages, or user types.
  6. Switch the chart type (table, bar chart, scatter plot, line, etc.) to best suit the data you are examining.

Explore reports are private by default — only you can see them unless you explicitly share them with other property users. For reports the entire team needs to access, publish them to a shared space or recreate them as custom reports in the standard Reports section.

How do you create and save custom reports in GA4?

GA4 allows you to build custom reports in the standard Reports section and save them to the navigation for ongoing use. This is distinct from Explore reports — custom reports in the Reports section are accessible to all users on the property.

  1. Navigate to Reports > Library (visible at the bottom of the Reports navigation).
  2. Click Create new report and choose between a Detail Report (table + chart) or a Funnel Report.
  3. Add the dimensions, metrics, and filters you need using the report builder on the right.
  4. Click Save, give the report a name, and optionally add it to an existing collection in the Reports navigation.
  5. To create a new collection (a group of related reports), go to Reports > Library and click Create new collection. Add your custom reports and publish the collection to make it visible in the left nav.

Linking GA4 to Google Ads enables bidirectional data sharing: GA4 key events appear as conversion actions in Google Ads, and Google Ads campaign data (including cost, clicks, and impressions) appears in GA4 reports. This integration is essential for accurate performance reporting and smart bidding.

  1. Go to Admin > Google Ads Links and click Link.
  2. Select the Google Ads accounts you want to link (you must have admin access to both).
  3. Review the configuration options — particularly whether to enable Auto-tagging (strongly recommended, as it appends gclid parameters to ad URLs for accurate attribution).
  4. Click Submit. The link activates within 24–48 hours.
  5. In Google Ads, go to Tools > Conversions. Your GA4 key events will now be importable as Google Ads conversion actions.

The Google Search Console integration adds a dedicated Search Console collection to your GA4 Reports, combining organic search performance data (impressions, clicks, average position, CTR by query and landing page) with GA4's behavioural data.

  1. Go to Admin > Search Console Links and click Link.
  2. Click Choose accounts, select the Search Console property that matches your GA4 web stream, and click Confirm.
  3. Select the GA4 web data stream to associate with this Search Console property, then click Next.
  4. Review the summary and click Submit. The link takes effect within 24 hours.
  5. Navigate to Reports > Library to find the Search Console collection and publish it to your navigation.

The Search Console reports in GA4 show data from the last 16 months, but only from the date the link was created. Linking early, even before your GA4 data accumulates, ensures you do not miss this search data retrospectively.

The BigQuery integration exports all raw, unsampled GA4 event data to Google Cloud's data warehouse every day. This is the only way to access data beyond GA4's retention limits and the only way to run complex SQL queries against your full event-level dataset.

  1. You must first have a Google Cloud project with BigQuery enabled and billing activated.
  2. In GA4, go to Admin > BigQuery Links and click Link.
  3. Select your Google Cloud project. If your GA4 account email has the necessary IAM roles on the project, it will appear in the list.
  4. Choose a data location (select a region close to your users for performance).
  5. Configure export frequency: Daily (free, exports previous day's data once per day) or Streaming (additional cost, near real-time data).
  6. Select which data streams to export and click Submit.

Once linked, BigQuery creates a dataset in your project with tables in the format events_YYYYMMDD. Each row in these tables is one event, with all its associated parameters stored in a nested event_params field. Access them using SQL via BigQuery Studio, Looker, or any compatible BI tool.

How do you set up cross-domain tracking in GA4?

Cross-domain tracking ensures that when a user travels from one domain you own (e.g. yourbrand.com) to another (e.g. checkout.yourbrand.com), GA4 treats them as the same user in a single continuous session, rather than counting a new user and session on the second domain.

  1. Go to Admin > Data Streams, select your web stream, and click Configure tag settings.
  2. Under Settings, click Configure your domains.
  3. Click Add condition and enter each domain you want to include (e.g. yourbrand.com, checkout.yourbrand.com).
  4. Click Save. GA4 will now automatically append a _gl linker parameter to links between these domains to pass identity across the domain boundary.

You must have the GA4 tracking code installed on all domains in the cross-domain list. Verify the setup by navigating between the two domains in your browser and confirming that the Realtime report shows the same Client ID throughout the session.

How do you configure data retention settings in GA4?

GA4's data retention setting determines how long event-level data is kept before it is automatically deleted. The default is 2 months. Extending it to 14 months ensures you can access user-level and event-level data in Explore reports for a full year without needing to resort to BigQuery.

  1. Go to Admin > Data Settings > Data Retention.
  2. Under Event data retention, change the dropdown from 2 months to 14 months.
  3. Consider enabling Reset user data on new activity — this restarts the retention clock whenever a user is active, meaning active users' data is never deleted while they remain engaged.
  4. Click Save.

It is important to note that aggregated data in standard reports (Acquisition, Engagement, Monetisation) is not affected by this setting — it is retained indefinitely. The retention limit only applies to event-level data used in Explore reports and raw exports. For unlimited event-level retention, use the BigQuery integration.

How do you enable Google Signals in GA4?

Google Signals uses data from users who are signed into their Google accounts and have opted into personalised ads. Enabling it allows GA4 to report on cross-device user journeys and enables demographic reporting (age, gender, interests) based on Google's ad profile data.

  1. Go to Admin > Data Settings > Data Collection.
  2. Under Google Signals data collection, click Get Started.
  3. Read the disclosure about data collection and click Continue, then Activate.
Privacy warning: Enabling Google Signals can trigger data thresholding — GA4 will withhold demographic data from reports when the user counts are too low to preserve anonymity. This can cause "(other)" rows to appear in your reports. If thresholding is severely impacting your data, consider disabling Google Signals for reporting purposes while retaining it only for remarketing via the Reporting Identity settings.

Consent Mode v2 (CM2) is Google's framework for adapting GA4 data collection based on the cookie consent choices made by users. It is required for advertisers running Google Ads campaigns targeting users in the European Economic Area (EEA) as of March 2024.

CM2 introduces two new consent signals on top of the original two:

ParameterControlsRequired for EEA?
analytics_storageGA4 analytics cookies and measurementYes
ad_storageGoogle Ads conversion and remarketing cookiesYes
ad_user_dataSending user data to Google for ad purposesYes (new in CM2)
ad_personalizationPersonalised advertising and remarketingYes (new in CM2)

Implementation requires a Certified CMP (Consent Management Platform) — such as Cookiebot, OneTrust, or Usercentrics — that integrates with GTM or fires the gtag consent commands directly. The CMP must set default consent state (typically denied for EEA users) before the GA4 tag fires, and then update to granted when the user consents. When consent is denied, GA4 uses modelling to estimate the behaviour of non-consenting users, ensuring your reports remain statistically useful.

How do you debug and test your GA4 implementation?

Verifying that your GA4 tracking is collecting the right data before relying on it for business decisions is non-negotiable. GA4 provides two dedicated tools for this.

DebugView

DebugView (under Admin > DebugView) shows a real-time stream of events from devices in debug mode. To activate debug mode:

  • Chrome extension: Install the Google Analytics Debugger Chrome extension and enable it. All events fired in that browser session will appear in DebugView.
  • GTM Preview mode: Entering GTM Preview Mode automatically activates debug mode for the browser window.
  • URL parameter: Append ?_ga4_debug=1 to any page URL to trigger debug mode for that session.

Realtime Report

The Reports > Realtime report shows all activity from the last 30 minutes. It is the quickest way to confirm a tag is firing — open your site in one browser tab and monitor incoming events in another. Click on any event in the Realtime report to see its associated parameters.

How do you set up GA4 e-commerce tracking?

GA4 e-commerce tracking is built around a set of recommended e-commerce events that must be implemented with specific parameters to populate the Monetisation reports correctly.

The core e-commerce events and when to fire them:

  • view_item_list — when a user sees a category or search results page showing multiple products.
  • view_item — when a user views a product detail page.
  • add_to_cart — when a user adds a product to their cart.
  • begin_checkout — when a user starts the checkout process.
  • add_payment_info — when a user enters payment details.
  • purchase — when a transaction is completed successfully. This event must include transaction_id, value, currency, and an items array with product details.
  • refund — when a full or partial refund is issued.

Each event must pass an items array containing objects with standardised parameters: item_id, item_name, item_category, price, and quantity. Most major e-commerce platforms (Shopify, WooCommerce, Magento) have GA4 integrations or plugins that handle this implementation automatically. For custom-built stores, the events must be coded manually or configured via GTM data layer.


Frequently Asked Questions

Universal Analytics used a session-and-pageview data model where the session was the primary unit of measurement. GA4 uses an event-based model where every interaction — pageviews, clicks, scrolls, video plays, purchases — is recorded as an event with attached parameters. GA4 also has native cross-device and cross-platform tracking, built-in machine learning for predictive metrics and modelled data, a privacy-first architecture with Consent Mode, and a free native integration with BigQuery. Universal Analytics was permanently shut down on July 1, 2024.

Go to Admin > Data Streams, select your web stream, and click "View tag instructions" under the Google tag section. Copy the entire gtag.js snippet and paste it as high as possible in the <head> section of every page on your site. Replace G-XXXXXXXXXX with your actual Measurement ID. Verify the installation by visiting your site and checking the Realtime report in GA4 for active user activity within a minute or two.

Key events are GA4 events that you designate as business-critical conversions — replacing the concept of "Goals" from Universal Analytics. Any event tracked in GA4 can be marked as a key event from Admin > Events by toggling the "Mark as key event" switch. Key events are highlighted in standard reports, can be used as conversion actions in Google Ads, and serve as the inputs for predictive audience models. The purchase event is automatically a key event when e-commerce tracking is in place.

Standard GA4 reports are unsampled. Sampling may occur in Explore reports when querying very large datasets over long date ranges — GA4 will display a warning indicator when sampling is applied. You can reduce sampling by shortening the date range, adding filters to narrow the dataset, or splitting the analysis into smaller segments. For guaranteed unsampled analysis at any scale, export your raw event data to BigQuery and run SQL queries there.

GA4 provides tools to support GDPR compliance, including Consent Mode v2, data deletion requests, IP anonymisation (enabled by default and not configurable), configurable data retention periods, and the ability to disable personalised advertising features. However, compliance is ultimately the responsibility of the website owner. A valid cookie consent mechanism from a certified CMP must be implemented alongside GA4, and your Privacy Policy must accurately disclose the use of analytics tracking to users.

Navigate to Reports > Realtime in the left sidebar. The Realtime report shows all user activity from the last 30 minutes, including a count of active users, a map of user locations, top active pages and screens, top traffic sources, and a minute-by-minute chart of event volume. You can click on any event row to see the specific parameters it carried. This report is also the fastest way to verify a new GA4 installation is collecting data correctly after deployment.

By default, GA4 stores event-level data for 2 months. You can extend this to the maximum of 14 months in Admin > Data Settings > Data Retention. This limit applies only to event-level data used in Explore reports — aggregated data in standard Reports is retained indefinitely. For unlimited retention of raw event-level data, the BigQuery integration is the recommended solution: daily exports store each day's events permanently in your own Google Cloud project.

The simplest method is a thank-you page redirect: after the form is submitted, send the user to a dedicated confirmation URL (e.g. /thank-you/) and track that page_view as a key event using the "Create event" feature in GA4 Admin. If no redirect exists, use Google Tag Manager with a Form Submission trigger to fire a custom GA4 event (e.g. contact_form_submit) on form completion. Enhanced Measurement's form_start and form_submit events may also capture some forms automatically, depending on how the form is coded.

Yes. GA4 is designed from the ground up to track websites and mobile apps within a single property using separate data streams. For iOS apps, integrate the Firebase SDK for iOS. For Android apps, use the Firebase SDK for Android. Once integrated, both app streams report into the same GA4 property alongside any web streams, enabling you to analyse complete cross-platform user journeys and identify where users drop off or convert across devices.

Goals from Universal Analytics are replaced by Key Events in GA4. Any event tracked in GA4 can be designated as a key event from the Admin > Events screen. This is a more flexible system than UA Goals because it is not limited to a fixed number of predefined conversion slots — you can mark as many events as you need. When your GA4 property is linked to Google Ads, key events automatically become available as conversion actions for campaign measurement and smart bidding optimisation.

RS

Written by

Rohit Sharma

Rohit is the Technical SEO Specialist & AI Search Researcher at TechOreo with 13+ years of experience in technical SEO, Core Web Vitals, GA4, and AI-powered search. He has helped 150+ websites achieve measurable organic growth and is a recognised voice on GEO and AEO strategy in the post-AI search landscape.