GA4 calculates engagement rate automatically, but many teams don't realize it's fundamentally different from Universal Analytics. You need to understand how GA4 defines engagement, access the metric correctly in your reports, and potentially pull the data via API for your own dashboards or product analytics integration.
Understanding GA4 Engagement Rate and Where to Find It
GA4 measures engagement differently than older analytics tools. Engagement rate shows the percentage of sessions that included meaningful user interactions.
Know what GA4 counts as engagement
In GA4, a session is 'engaged' if it lasts 10+ seconds OR includes at least one conversion event OR has 2+ page views. Engagement rate is the percentage of sessions meeting these criteria. This is automatically calculated—no setup needed. Check your Admin > Session settings if you've customized session timeout (default is 30 minutes).
Find engagement rate in the GA4 dashboard
Open GA4, navigate to Reports > Engagement > Overview. You'll see engagement rate displayed prominently at the top. To dig deeper, go to Reports > Engagement > Pages and screens to see which pages drive engagement. You can also add engagement rate as a custom column in any report by clicking the Columns button and selecting the metric. For programmatic access, use the Data API.
// Fetch engagement rate data via Google Analytics Data API
const {BetaAnalyticsDataClient} = require('@google-analytics/data');
const analyticsDataClient = new BetaAnalyticsDataClient();
async function getEngagementRate(propertyId) {
const [response] = await analyticsDataClient.runReport({
property: `properties/${propertyId}`,
dateRanges: [{startDate: '2024-01-01', endDate: '2024-03-26'}],
metrics: [{name: 'engagementRate'}],
dimensions: [{name: 'date'}]
});
response.rows.forEach(row => {
const date = row.dimensionValues[0].value;
const rate = row.metricValues[0].value;
console.log(`${date}: ${(rate * 100).toFixed(2)}%`);
});
}
getEngagementRate('YOUR_GA4_PROPERTY_ID');Pull Engagement Data via the Reporting API
If you're building custom dashboards or feeding GA4 data into your product analytics platform, query the API directly rather than manually exporting from GA4.
Authenticate with a service account
Create a service account in Google Cloud Console > Service Accounts and generate a JSON key. Grant it the Viewer role on your GA4 property. Install the @google-analytics/data npm package, then initialize the client by setting the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your key file.
npm install @google-analytics/data
const {BetaAnalyticsDataClient} = require('@google-analytics/data');
// Set environment variable: export GOOGLE_APPLICATION_CREDENTIALS="./service-account-key.json"
const analyticsDataClient = new BetaAnalyticsDataClient({
keyFilename: process.env.GOOGLE_APPLICATION_CREDENTIALS
});Query engagement rate by dimension
Use runReport() to fetch engagement rate broken down by page, traffic source, or device. Combine engagementRate with dimensions like pagePath or sessionDefaultChannelGrouping to understand which channels or pages drive engagement. The API returns data sorted by your chosen dimension.
async function getEngagementByPage(propertyId) {
const [response] = await analyticsDataClient.runReport({
property: `properties/${propertyId}`,
dateRanges: [{
startDate: '2024-03-01',
endDate: '2024-03-26'
}],
metrics: [
{name: 'engagementRate'},
{name: 'engagedSessions'},
{name: 'totalUsers'}
],
dimensions: [
{name: 'pagePath'},
{name: 'deviceCategory'}
],
orderBys: [
{metric: {metricName: 'engagementRate'}, descending: true}
]
});
response.rows.forEach(row => {
const page = row.dimensionValues[0].value;
const device = row.dimensionValues[1].value;
const engagement = (row.metricValues[0].value * 100).toFixed(2);
console.log(`${page} (${device}): ${engagement}% engaged`);
});
}
getEngagementByPage('YOUR_GA4_PROPERTY_ID');limit parameter in runReport() to control how many rows you get back.Track Custom Engagement Events
Sometimes GA4's default engagement definition doesn't match your product. You can send custom events to fine-tune what counts as engagement for your reporting.
Send custom events via gtag
Use the gtag.js library (included automatically in GA4) to send custom events. Any event you send contributes to session engagement if the session includes 2+ events total or if you mark the event as a conversion. Fire events on user actions like video plays, form submissions, or file downloads.
// Track video playback as an engagement event
gtag('event', 'video_play', {
'video_title': 'How to Use GA4',
'video_duration': 120,
'video_provider': 'youtube'
});
// Track form submission
gtag('event', 'form_submit', {
'form_name': 'newsletter_signup',
'form_location': 'homepage_footer'
});
// Mark a purchase as a conversion (counts toward engagement)
gtag('event', 'purchase', {
'value': 99.99,
'currency': 'USD',
'transaction_id': 'TXN12345'
});Mark events as conversions in GA4
Navigate to Admin > Events in GA4. Find your custom event and toggle Mark as conversion. Now this event will show up in your engagement reports and conversion funnels. Only mark events as conversions if they represent true user value—too many conversions dilutes the signal.
Common Pitfalls
- Confusing engagement rate with bounce rate—GA4's bounce rate measures sessions with zero events; engagement rate measures sessions with meaningful activity (10+ seconds, 2+ pages, or a conversion). A session can bounce and not be engaged.
- Not realizing GA4 engagement depends on your session timeout setting—if you change Admin > Session settings to a 15-minute timeout instead of the default 30 minutes, engagement thresholds change. Sessions shorter than 10 seconds won't be counted as engaged.
- Using the old Universal Analytics engagement definition—UA measured engagement differently (time on page, events, goals). GA4's engagement rate is not comparable year-over-year if you migrated from UA without mapping your old logic to custom events.
- Forgetting to authenticate the Data API—the gtag.js library runs client-side automatically and needs no setup, but API access requires a service account with proper credentials. You'll get an auth error if you try to fetch data without setting
GOOGLE_APPLICATION_CREDENTIALS.
Wrapping Up
GA4 calculates engagement rate automatically from session behavior—no setup required to start collecting it. You can view it in the Engagement reports, pull it via the Reporting API, or define custom engagement events for your specific product flows. If you want to track this automatically across tools and sync engagement data into your own analytics warehouse, Product Analyst can help.