Matomo Heartbeat Extra Quality -

return ['status' => 'updated', 'total_time' => $newTotalTime]; else // Session expired $this->endSession($session['id']); return $this->createNewSession($sessionId, $visitorId, $pageUrl);

if ($this->tokenAuth) $params['token_auth'] = $this->tokenAuth; matomo heartbeat

For publishers and media sites, the Heartbeat is indispensable. It allows analysts to differentiate between: return ['status' =&gt

sendHeartbeat(type) const now = Date.now(); const timeSinceLastHeartbeat = (now - this.lastHeartbeatTime) / 1000; else // Session expired $this-&gt

If you have millions of visitors, a 15-second heartbeat can significantly increase your database size and CPU usage. Consider increasing the interval to 30 or 60 seconds.