After update matomo to 4.12.0 and replaced the legacy iframe opt-out with the new opt-out using the matomo javascript tracker code, the opt-out status is not saved or is exactly the opposite of the selected status after a page reload.
This matomo tracker js code is placed before </body>
, but eaven in the <head>
, the opt-out status is not saved correctly:
<script>
var _paq = window._paq = window._paq || [];
_paq.push(["disableCookies"]);
_paq.push(['disableBrowserFeatureDetection']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://stats.REMOVED.de/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
opt-out code in the page content (TYPO3 CMS):
<div id="matomo-opt-out"></div>
<script src="https://stats.REMOVED.de/index.php?module=CoreAdminHome&action=optOutJS&divId=matomo-opt-out&language=auto&showIntro=1"></script>
Strangely enough, the cookie “mtm_consent_removed” is sometimes set when the page is opened, even though the opt-out form checkbox is checked. After a page reload, the opt-out form checkbox is not active and the cookie is gone. Shouldn’t it be the other way around? After another reload of the page, the opt-out form checkbox is set again and the cookie “mtm_consent_removed” is also there again. If the checkbox is deactivated by clicking on it, the cookie is set correctly. But if i reload the page, the cookie is gone. I suspect there are errors in the script that controls the new opt-out form.
Browser security/privacy settings default.
Matomo-Version: 4.12.0
MySQL-Version: 10.5.17-MariaDB-1:10.5.17+maria~deb10
PHP-Version: 8.1.11
3 posts - 2 participants