Real time reporting in Google Analytics 4 lets you see user activity as it happens—no waiting for daily reports. You can spot campaign issues instantly, debug event tracking problems, or monitor active user counts on your site right now. It's the difference between reacting to data hours later and catching problems within seconds.
What Real Time Reporting Shows You
GA4's real-time reports give you a live view of what's happening on your site or app at this moment.
Understand real-time data latency
Real-time events in GA4 typically appear within 30 seconds to 2 minutes of occurring. This isn't the same as the 24–48 hour processing lag for standard reports. The Real time report in GA4 shows active users, the pages they're viewing, events they're triggering, and their geographic location—all with minimal delay.
// Real-time data is fetched via the Analytics Data API
// Request structure for real-time events (last 30 minutes)
const request = {
property: 'properties/YOUR_GA4_PROPERTY_ID',
metrics: [
{name: 'activeUsers'},
{name: 'eventCount'}
],
dimensions: [
{name: 'eventName'},
{name: 'pagePath'}
],
minuteRanges: [
{
startMinutesAgo: 30,
endMinutesAgo: 0
}
]
};Know what real-time reporting cannot do
Real-time reports don't show historical trends or comparisons to previous periods. You can't set up alerts within GA4 itself, and real-time data is deleted after 30 days. If you need alerts or long-term retention, query the API and pipe data to a separate tool.
How to Query Real Time Data Programmatically
If you want custom dashboards or real-time alerts, use the Google Analytics Data API v1beta.
Initialize the Analytics Data API client
Authenticate with a service account and initialize the BetaAnalyticsDataClient. You'll need your GA4 property ID from Admin > Property Settings.
const {BetaAnalyticsDataClient} = require('@google-analytics/data');
const analyticsDataClient = new BetaAnalyticsDataClient({
projectId: 'YOUR_GCP_PROJECT_ID',
keyFilename: '/path/to/service-account-key.json'
});Call runRealtimeReport to fetch live events
Use the runRealtimeReport() method to get events from the last 0–30 minutes. This method only returns today's data and doesn't support historical date ranges. Include metrics like activeUsers, eventCount, or conversions and dimensions like eventName, pagePath, or country.
const response = await analyticsDataClient.runRealtimeReport({
property: 'properties/YOUR_GA4_PROPERTY_ID',
metrics: [
{name: 'activeUsers'},
{name: 'eventCount'}
],
dimensions: [
{name: 'eventName'},
{name: 'pagePath'}
],
minuteRanges: [
{
startMinutesAgo: 30,
endMinutesAgo: 0
}
]
});
response[0].rows.forEach(row => {
console.log(`${row.dimensionValues[0].value}: ${row.metricValues[0].value}`);
});Filter by specific events or conditions
Add filters to narrow down real-time data—for example, show only purchase events or traffic from a specific campaign. Filters work the same way as in standard runReport() calls.
const response = await analyticsDataClient.runRealtimeReport({
property: 'properties/YOUR_GA4_PROPERTY_ID',
metrics: [{name: 'eventCount'}],
dimensions: [{name: 'eventName'}],
minuteRanges: [{startMinutesAgo: 10, endMinutesAgo: 0}],
dimensionFilter: {
filter: {
fieldName: 'eventName',
stringFilter: {
matchType: 'EXACT',
value: 'purchase'
}
}
}
});
response[0].rows.forEach(row => {
console.log(`Purchase events: ${row.metricValues[0].value}`);
});runRealtimeReport() method doesn't support period comparisons or calculated fields. Use standard runReport() for those.How to Access Real Time Reports in the GA4 UI
You don't need code to see real-time data. GA4 has a built-in dashboard.
Open the Real time report
In GA4, go to Reports > Real time. This dashboard shows active user count, events by name, pages by path, and user location. The data refreshes every few seconds automatically.
// To programmatically fetch and display real-time data in your own dashboard:
setInterval(async () => {
const response = await analyticsDataClient.runRealtimeReport({
property: 'properties/YOUR_GA4_PROPERTY_ID',
metrics: [{name: 'activeUsers'}],
minuteRanges: [{startMinutesAgo: 5, endMinutesAgo: 0}]
});
const activeUsers = response[0].rows[0]?.metricValues[0]?.value || 0;
document.getElementById('active-users').textContent = activeUsers;
}, 5000); // Poll every 5 secondsUse real-time data to debug events
The real-time report is your debugging tool. If you just fired a custom event, check Real time > Events to confirm it's being tracked correctly. Look for the event name, count, and any custom event parameters.
Common Pitfalls
- Assuming real-time data is 100% accurate. Under very high traffic, GA4 samples data, so event counts may be estimates, not exact numbers.
- Trying to use
runRealtimeReport()with date ranges. The real-time API only acceptsminuteRanges(0–30 minutes ago), not historicaldateRanges. - Forgetting that real-time data expires after 30 days. If you need to store or analyze real-time events long-term, export to BigQuery or a data warehouse.
- Building alerts on real-time data without error handling. Network delays and API timeouts can cause missed events. Always add retry logic and fallback logic to your alert system.
Wrapping Up
Real-time reporting in Google Analytics 4 gives you immediate visibility into what users are doing on your site right now—whether you're using the built-in dashboard or querying the API programmatically. It's invaluable for debugging events, monitoring campaigns, and catching issues before they escalate. If you want to track this automatically across tools, Product Analyst can help.