Skip to content

Matomo Heartbeat -

public function getEngagementMetrics($dateFrom, $dateTo) $stmt = $this->db->prepare(" SELECT COUNT(DISTINCT session_id) as total_sessions, SUM(total_engaged_time) as total_engagement_seconds, AVG(total_engaged_time) as avg_engagement_seconds, AVG(heartbeat_count) as avg_heartbeats_per_session, COUNT(CASE WHEN total_engaged_time > 60 THEN 1 END) as long_sessions, COUNT(CASE WHEN total_engaged_time < 10 THEN 1 END) as bounce_sessions FROM matomo_heartbeat_sessions WHERE start_time BETWEEN ? AND ? AND is_active = 0 ");

Matomo Heartbeat: Fixing the "Zero Second" Visit Problem If you've spent any time looking at your Matomo Analytics reports, you might have noticed something strange: a high number of visitors spend exactly "0 seconds" on your site. Are they all bots? Did they click away instantly? Usually, the answer is "no." By default, web analytics tools like Matomo can only calculate time spent when a user clicks from one page to a matomo heartbeat

var _paq = window._paq = window._paq || []; // Enable heartbeat (time in seconds) // Recommended setting: 15 or 30 seconds _paq.push(['enableHeartBeatTimer', 15]); Are they all bots

return $metrics;

I'll help you develop a Matomo Heartbeat feature. This feature tracks user engagement time more accurately by sending periodic heartbeats to Matomo analytics. This feature tracks user engagement time more accurately

If you run a blog or a news site, a user might find exactly what they need in one article and then leave. Without Heartbeat, this looks like a 0-second visit. With Heartbeat enabled, you can see that the user actually spent five minutes reading your content. 2. Measuring Engagement on Long-Form Content