Hi @jarnovos,
Thanks for your reply and sorry for the late update.
This is my solution right now. Not fancy, but I think it’s working. ??
Would be nice though to know the reason why cmplzStatusChange
is not working the way I think it should be.
Regards,
Mark
(function ($) {
$(function () {
let $cc_window;
const waitForCmplz = setInterval(function () {
$cc_window = $('#cc-window');
if ($cc_window.length > 0) {
clearInterval(waitForCmplz);
const $statistics = $cc_window.find('#cmplz_statistics');
$cc_window.find('.cc-save').on('click', function () {
if ($statistics.is(':checked')) {
_paq.push(['setConsentGiven']);
_paq.push(['rememberConsentGiven']);
_paq.push(['forgetUserOptOut']);
console.log('matomo optin');
} else {
if (!$('body').hasClass('cmplz-status-functional')) {
//_paq.push(['forgetConsentGiven']);
_paq.push(['optUserOut']);
console.log('matomo optout');
}
}
});
}
}, 10); // Wait for the input-field to appear
});
})(jQuery);
document.addEventListener('cmplzRevoke', function () {
_paq.push(['optUserOut']);
console.log('matomo optout');
});
-
This reply was modified 3 years, 4 months ago by
mschmale.
-
This reply was modified 3 years, 4 months ago by
mschmale.
-
This reply was modified 3 years, 4 months ago by
mschmale.
-
This reply was modified 3 years, 4 months ago by
mschmale.