Have you ever considered the feasibility of enabling the Heatmap and Session Recording feature based on user consent? If this idea has crossed your mind, rest assured that it’s indeed possible. Within Matomo, you can activate this feature when a user explicitly requests and consents to it.

Please follow these instructions:

  1. To deactivate Heatmaps and Session Recording, please add _paq.push(['HeatmapSessionRecording::disable']); in your tracking code.
  2. To require user cookie consent before storing and using any cookies, add _paq.push(['requireCookieConsent']);
  3. To remember cookie consent was given for all subsequent page views and visits, add _paq.push(['rememberCookieConsentGiven']);.
  4. Once the user has given consent to process their data use _paq.push(['setConsentGiven']); and to activate heatmaps and session recording by inserting the script _paq.push(['HeatmapSessionRecording::enable']);.

If a visitor chooses to withdraw their consent at a later point, you may need to remove the cookie consent. You can do this by using _paq.push(['forgetCookieConsentGiven']);. In such a case, do remember to disable the Heatmap and Session Recording feature, as explained in Step 1.

Previous FAQ: How do I disable only the heatmaps feature?