/
(2a) Quick Upgrade
(2a) Quick Upgrade
Der einfachste Weg das Upgrade auszuführen ist es nur das CMP-Script auszutauschen und folgendes Script global zu hinterlegen.
Dies ist möglich, da das UC_UI-Objekt sowie die alten Methoden backwards compatible sind.
Ausschließlich die Funktionsänderung der Akzeptieren-Funktion muss überschrieben werden, da diese nun aus zwei Teilen (Akzeptieren + Speichern) besteht.
<script>
(function() {
// Polling function to check if UC_UI is defined
const checkUCUI = setInterval(function() {
// If UC_UI and UC_UI.acceptService are defined, override the method
if (typeof UC_UI !== 'undefined' && typeof UC_UI.acceptService === 'function') {
// Save the reference to the original UC_UI.acceptService function
const originalAcceptService = UC_UI.acceptService;
// Override the acceptService function
UC_UI.acceptService = function(serviceId) {
// Call the original function
originalAcceptService(serviceId);
// Call the __ucCmp.saveConsents function after the service is accepted
setTimeout(function() {
__ucCmp.saveConsents();
}, 0); // Ensure saveConsents runs after acceptService
};
// Stop checking once UC_UI is defined and overridden
clearInterval(checkUCUI);
}
}, 100); // Check every 100ms
})();
</script>