@tsteur opened this Pull Request on October 25th 2019 Member

fix https://github.com/matomo-org/matomo/issues/15049

Currently, when the heart beat timer is enabled, we ping every 15s the Matomo server. If you have 1000 visitors on your page that makes 66req/s. It also sends a request every time you focus the window after you were on another tab.

This PR implements pretty much the opposite behaviour:

  • Ping only on window blur (never on focus)
  • On window blur send only a request if the user was on the page for at least 15 seconds (or whatever is configured as heart beat timeout). Otherwise user maybe was just quickly switching between tabs but not actively on the page
  • Ping on unload of browser window but only when user was on page > 15 seconds (or configured heart beat timeout)
  • Stop sending ping requests 30 minutes after the first request (as it would not have any effect anyway)
  • Now requiring at least 5 seconds to be configured as heart beat timer as every second be quite extreme and we want to prevent this.

This means instead of possibly sending heaps of requests every few seconds we typically would maybe send one or two ping requests per pageview. Most of the times it be one (on page unload) or even none (when user was only a few seconds on a page).

Behaviour is otherwise the same, it's just more efficient by not sending as many requests. Instead we only send requests when needed. Which is either when the user is leaving the window, or closes the window.

This Pull Request was closed on November 5th 2019
Powered by GitHub Issue Mirror