Files
szkoleniauryzaj.pl/wp-content/plugins/beautiful-and-responsive-cookie-consent/public/onStatusChange.js
2024-11-10 21:08:49 +01:00

29 lines
1.0 KiB
JavaScript

var dataToPushToDl = getupdatedValues(cookieTypes, cookieRootName);
dataToPushToDl.event = "beautiful_cookie_consent_updated";
// goal: remove dismiss completly from application. Problem: is saved in cookie for "just info". For backward compatibility hard to change.
// first step: in datalayer dismiss will never appear.
if (status === "dismiss") {
status = "allow";
}
dataToPushToDl.cookieconsent_status = status;
dataToPushToDl.statusBefore = chosenBefore;
window[dataLayerName] = window[dataLayerName] || [];
window[dataLayerName].push(dataToPushToDl);
function getupdatedValues(cookieTypes, cookieRootName) {
var updatedValues = {};
for (var i = 0, len = cookieTypes.length; i < len; i += 1) {
var b = document.cookie.match(
"(^|;)\\s*" + cookieRootName + "_" + cookieTypes[i]["cookie_suffix"] + "\\s*=\\s*([^;]+)"
);
var cookieValue = b ? b.pop() : "";
if (cookieValue) {
updatedValues["cookieconsent_status_" + cookieTypes[i]["cookie_suffix"]] = cookieValue;
}
}
return updatedValues;
}