Skip to Content

What is GA4?

image

Definition

GA4 (Google Analytics 4) is Google's latest web and app analytics platform. Launched in October 2020, it completely replaced the previous version, Universal Analytics, on July 1, 2023. GA4 is not simply an upgraded version but a completely redesigned platform based on a new data collection and analysis philosophy.

The biggest feature of GA4 is that it uses an event-based data model. While Universal Analytics was centered on sessions and pageviews, GA4 tracks all user interactions as events. Every action such as page views, clicks, scrolls, and video plays is recorded as an event, enabling more detailed analysis. Additionally, you can analyze data from both websites and mobile apps in a single property, making it very useful for understanding cross-platform user journeys.

GA4 has significantly enhanced machine learning and AI capabilities. Through predictive metrics, you can predict users' future behavior, and automated insights automatically detect and notify you of important trends. It also provides cookieless measurement and data lifecycle management features to align with the era of privacy protection. It's designed to enable effective analysis while complying with privacy regulations such as GDPR in Europe and CCPA in the United States.

Features

  • Event-based Data Model: Tracks all user interactions as events, enabling more flexible and detailed analysis. Everything is an event: pageviews, clicks, scrolls, video plays, file downloads, etc.
  • Cross-platform Analysis: Analyze data from both websites and iOS/Android apps in one property, allowing you to fully track user journeys across multiple devices.
  • AI and Machine Learning: Provides predictive metrics like purchase probability and churn probability, and automated insights automatically detect traffic spikes, anomalous patterns, etc.
  • Privacy-focused: Offers various features for compliance with privacy regulations, including cookieless measurement, IP anonymization, and data retention settings.
  • Free BigQuery Integration: All GA4 properties can export raw data to BigQuery for free, enabling advanced analysis and data warehouse integration. (Only available in paid version of Universal Analytics)

How to Use

Here's how to effectively set up and use GA4:

Step 1: Create GA4 Property After logging into your Google Analytics account, create a new GA4 property. Select "Create Property" from the Admin menu and enter your website or app information. When you select your business category and size, GA4 automatically provides relevant reports and insights.

Step 2: Set Up Data Stream For websites, create a web data stream; for mobile apps, create an iOS or Android data stream. When you create a web data stream, you'll receive a Measurement ID (in the format G-XXXXXXXXXX), which must be inserted into all pages of your website. Using Google Tag Manager makes this easier to manage.

<!-- Global site tag (gtag.js) - Google Analytics -->
<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>

Step 3: Set Up Key Events In addition to automatically collected events (page views, scrolls, etc.), GA4 allows you to manually track events that are important to your business goals. For example, set up conversion events like "Purchase Completed", "Sign Up", "Newsletter Subscription", "Contact Us Click". By marking these events as "Conversions", you can easily track them in reports.

Step 4: Create Custom Dimensions and Metrics You can create custom dimensions and custom metrics to track specific data needed for your business. For example, for a blog, you can create custom dimensions like "Article Category", "Author Name", "Reading Time" for more detailed analysis.

Step 5: Customize Reports While GA4's default reports are useful, you can activate additional reports from the library or create custom reports using Explorations. Advanced analysis templates such as path exploration, funnel exploration, and segment overlap are provided.

Step 6: Use Audiences and Predictive Metrics One of GA4's powerful features is machine learning-based predictive metrics. You can optimize marketing campaigns using metrics like "Purchase Probability", "Churn Probability", and "Predicted Revenue". Creating custom audiences based on these and integrating them with Google Ads significantly improves targeting efficiency.

Step 7: Integrate with Google Ads and Search Console Integrating GA4 with your Google Ads account allows you to measure ad performance more accurately. Integrating with Search Console allows you to see search query data in GA4, which helps with SEO analysis. Integration can be set up in the "Product Links" section of the Admin menu.

Step 8: Regular Data Review and Insights GA4 provides data from various perspectives, including real-time reports, user reports, and lifecycle reports. Check key metrics at least once a week and review automated insights to improve your website. It's particularly important to focus on engagement metrics and conversion metrics.

Examples

Example 1: Basic GA4 Installation Code

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Zero Coke Blog</title>

<!-- GA4 Installation Code -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ABC123XYZ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

// Basic configuration
gtag('config', 'G-ABC123XYZ', {
'send_page_view': true,
'anonymize_ip': true // IP anonymization
});
</script>
</head>
<body>
<h1>Blog Post Title</h1>
<p>Content...</p>
</body>
</html>

Example 2: Custom Event Tracking (Button Click)

<button onclick="trackNewsletterSignup()">Subscribe to Newsletter</button>

<script>
function trackNewsletterSignup() {
// Send GA4 event
gtag('event', 'newsletter_signup', {
'event_category': 'engagement',
'event_label': 'header_newsletter_form',
'value': 1
});

// Actual newsletter subscription logic
console.log('Newsletter subscription completed');
}
</script>

Example 3: E-commerce Event Tracking

// Product view event
gtag('event', 'view_item', {
currency: 'KRW',
value: 129000,
items: [
{
item_id: 'XYZ2000-BLK',
item_name: 'Wireless Bluetooth Earphones XYZ-2000',
item_category: 'Electronics',
item_category2: 'Audio',
item_brand: 'TechSound',
price: 129000,
quantity: 1
}
]
});

// Add to cart event
gtag('event', 'add_to_cart', {
currency: 'KRW',
value: 129000,
items: [
{
item_id: 'XYZ2000-BLK',
item_name: 'Wireless Bluetooth Earphones XYZ-2000',
price: 129000,
quantity: 1
}
]
});

// Purchase complete event
gtag('event', 'purchase', {
transaction_id: 'T_12345',
currency: 'KRW',
value: 129000,
tax: 11727,
shipping: 3000,
items: [
{
item_id: 'XYZ2000-BLK',
item_name: 'Wireless Bluetooth Earphones XYZ-2000',
price: 129000,
quantity: 1
}
]
});

Example 4: Scroll Depth Tracking

// Send event when scrolled to specific points on the page
let scrollTracked = {
'25': false,
'50': false,
'75': false,
'100': false
};

window.addEventListener('scroll', function() {
let scrollPercentage = (window.scrollY + window.innerHeight) / document.body.scrollHeight * 100;

for (let threshold in scrollTracked) {
if (scrollPercentage >= threshold && !scrollTracked[threshold]) {
gtag('event', 'scroll_depth', {
'event_category': 'engagement',
'event_label': threshold + '%',
'value': parseInt(threshold)
});
scrollTracked[threshold] = true;
}
}
});

Example 5: Outbound Link Click Tracking

// Automatically track all outbound link clicks
document.addEventListener('click', function(event) {
let target = event.target.closest('a');

if (target && target.hostname !== window.location.hostname) {
gtag('event', 'click', {
'event_category': 'outbound_link',
'event_label': target.href,
'transport_type': 'beacon'
});
}
});

Example 6: File Download Tracking

<a href="/downloads/seo-guide.pdf" onclick="trackDownload(this)">Download SEO Guide</a>

<script>
function trackDownload(element) {
let fileName = element.href.split('/').pop();

gtag('event', 'file_download', {
'event_category': 'downloads',
'event_label': fileName,
'file_extension': fileName.split('.').pop(),
'file_name': fileName
});
}
</script>

Example 7: Video Viewing Tracking

<video id="tutorial-video" controls>
<source src="tutorial.mp4" type="video/mp4">
</video>

<script>
let video = document.getElementById('tutorial-video');
let videoTracked = {
'start': false,
'25': false,
'50': false,
'75': false,
'complete': false
};

video.addEventListener('play', function() {
if (!videoTracked['start']) {
gtag('event', 'video_start', {
'event_category': 'video',
'event_label': 'tutorial-video',
'video_title': 'SEO Tutorial'
});
videoTracked['start'] = true;
}
});

video.addEventListener('timeupdate', function() {
let percentage = (video.currentTime / video.duration) * 100;

if (percentage >= 25 && !videoTracked['25']) {
gtag('event', 'video_progress', {
'event_category': 'video',
'event_label': 'tutorial-video',
'video_percent': 25
});
videoTracked['25'] = true;
}
// Same for 50%, 75%...
});

video.addEventListener('ended', function() {
gtag('event', 'video_complete', {
'event_category': 'video',
'event_label': 'tutorial-video'
});
videoTracked['complete'] = true;
});
</script>

Pros and Cons

Pros

  • Future-oriented Analysis: The event-based model and AI features are more suitable for the changing digital environment. It's designed to respond to cookie restrictions and enhanced privacy protection.

  • Cross-platform Integration: Analyze data from both websites and mobile apps in one property to understand the entire user journey. You can track patterns like users browsing products on mobile apps and purchasing on the website later.

  • Predictive Capabilities: Machine learning-based predictive metrics allow you to proactively identify users with high churn probability or high purchase probability and respond preemptively. This is very useful for efficiently allocating marketing budgets.

Cons

  • Steep Learning Curve: It has a completely different structure from Universal Analytics, so even existing users need to learn anew. It takes time to adapt to the event-based model, new report structure, different terminology, etc.

  • Limited Historical Data: Universal Analytics data cannot be automatically migrated. GA4 collects data anew from the time of installation, making it difficult to compare with historical data. To analyze historical trends in conversion reports, Universal Analytics data must be stored separately.

  • Complex Setup: Initial setup is more complex than Universal Analytics. In particular, e-commerce tracking, custom events, and conversion setup require technical knowledge, and without proper setup, it's difficult to obtain accurate data. Many companies are getting help from experts for setup.

FAQ

Q: Can I use Universal Analytics and GA4 simultaneously? A: Yes, it's possible. However, Universal Analytics completely stopped data collection on July 1, 2023, so you must now use only GA4. Before July 2023, you could run both properties simultaneously to compare data and familiarize yourself with GA4 during the transition period. If you're starting now, you only need to install GA4.

Q: How are GA4 events different from Universal Analytics events? A: In Universal Analytics, events had a fixed structure of "category, action, label, value". In GA4, all interactions are events, and you can freely add any parameters you want to each event. It's much more flexible, but you need to plan consistent naming conventions and data structures in advance. For example, pageviews are also processed as 'page_view' events in GA4.

Q: How is bounce rate calculated in GA4? A: The bounce rate definition in GA4 is completely different from Universal Analytics. In Universal Analytics, a bounce was defined as a session where only one page was viewed before leaving, but in GA4, bounce rate is defined as the percentage of sessions that are not "engaged sessions". An engaged session is one that lasts 10 seconds or more, views 2 or more pages, or has a conversion event. Therefore, GA4's bounce rate generally appears lower.

Q: How long is GA4 data retained? A: By default, event data can be retained for 2 months or 14 months (in the free version). You can select the retention period in settings, and once set, it does not apply retroactively to past data, so it's better to set it to 14 months from the start. Aggregated report data is retained indefinitely. If you want to store raw data long-term, set up BigQuery export (free).