Measuring consent rates with Matomo
To be able to measure the consent rate using Matomo, only 1 line of JavaScript code per button is required.
Why use Matomo? Matomo can be loaded without consent. It is therefore suitable for this type of analysis, as all visitors can usually be measured.
Other analysis tools such as Piwik or Plausible would also be suitable for this. It is important that they are those that can be loaded without consent.
The following 3 snippets must be added within a script tag in the HTML of the page so that the popup events can be waited for.
Accept selection” button
window.addEventListener('lw-popupaction-accept-selected-complete', function (e) { if (_paq != null) _paq.push(['trackEvent', 'CMP', 'CMP Button Clicked', 'Accept Selected']); });
Accept all” button
window.addEventListener('lw-popupaction-accept-all-complete', function (e) { if (_paq != null) _paq.push(['trackEvent', 'CMP', 'CMP Button Clicked', 'Accept All']); });
Button “Accept nothing”
window.addEventListener('lw-popupaction-dismiss-all-complete', function (e) { if (_paq != null)_paq.push(['trackEvent', 'CMP', 'CMP Button Clicked', 'Dismiss All']); });
Result
