jetzt nochmals überarbeitet, kannst du testen wenn du möchtest.
In der Datei /includes/external/smarty/plugins/function.piwik.php ab ca. Zeile 55 folgende Codesequenz:
mit dieser Codesequenz ersetzen.
Dann in der Datei /templates/dein_template/javascript/general_bottom.js.php ganz am Ende, also nach "?>" folgenden Code einfügen.
<?php if (defined('MODULE_COOKIE_CONSENT_STATUS') && strtolower(MODULE_COOKIE_CONSENT_STATUS
) == 'true' && (in_array(7, $_SESSION['tracking']['allowed']) || defined('COOKIE_CONSENT_NO_TRACKING'))) { ?><script>
$(document).ready(function(){
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
(function () {
var oilCookie = getCookie('oil_data');
var type = $('script[data-purposes="7"]').attr('type');
var text = $('#matomo').text();
if (oilCookie != "" && type == 'as-oil') {
$('#matomo').text(text.replace("// _paq.push(['disableCookies']);", "_paq.push(['disableCookies']);")).removeAttr('type');
$('#matomo').replaceWith(document.getElementById("matomo").outerHTML);
} else if (oilCookie != "" && (type == 'text/javascript' || type == null)) {
$('#matomo').removeAttr('type');
$('#matomo').replaceWith(document.getElementById("matomo").outerHTML);
}
})();
$('.as-oil__btn-optin').click(function() {
var oilCookie = getCookie('oil_data');
var type = $('script[data-purposes="7"]').attr('type');
var text = $('#matomo').text();
if (oilCookie != "" && type == 'as-oil') {
$('#matomo').text(text.replace("// _paq.push(['disableCookies']);", "_paq.push(['disableCookies']);")).removeAttr('type');
$('#matomo').replaceWith(document.getElementById("matomo").outerHTML);
} else if (oilCookie != "" && (type == 'text/javascript' || type == null)) {
$('#matomo').removeAttr('type');
$('#matomo').replaceWith(document.getElementById("matomo").outerHTML);
}
});
});
</script>
<?php } ?>