PageSourceSearch

https://www.silex.co.uk/wp-content/plugins/cookie-law-info/lite/frontend/js/gcm.js

js silex.co.uk collected 2026-10-04 13:29:21 UTC 3,450 bytes, 100 lines download raw bytes

1const _ckyGcmData = window._ckyGcm;
2let setDefaultSetting = true;
3const regionSettings = _ckyGcmData.default_settings || [];
4const waitForTime = _ckyGcmData.wait_for_update;
5
6function getCookieValues(cookieName) {
7    const values = [];
8    const name = cookieName + "=";
9    const decodedCookie = decodeURIComponent(document.cookie);
10    const cookieArray = decodedCookie.split(';');
11    
12    for (let i = 0; i < cookieArray.length; i++) {
13        let cookie = cookieArray[i];
14        while (cookie.charAt(0) === ' ') {
15            cookie = cookie.substring(1);
16        }
17        if (cookie.indexOf(name) === 0) {
18            values.push(cookie.substring(name.length, cookie.length));
19        }
20    }
21    return values;
22}
23
24function getConsentStateForCategory(categoryConsent) {
25    return categoryConsent === "yes" ? "granted" : "denied";
26}
27
28const dataLayerName =
29  window.ckySettings && window.ckySettings.dataLayerName
30    ? window.ckySettings.dataLayerName
31    : "dataLayer";
32 window[dataLayerName] = window[dataLayerName] || [];
33 function gtag() {
34  window[dataLayerName].push(arguments);
35}
36
37function setConsentInitStates(consentData) {
38    if (waitForTime > 0) consentData.wait_for_update = waitForTime;
39    gtag("consent", "default", consentData );
40}
41
42gtag("set", "ads_data_redaction", !!_ckyGcmData.ads_data_redaction);
43gtag("set", "url_passthrough", !!_ckyGcmData.url_passthrough);
44gtag("set", "developer_id.dY2Q2ZW", true);
45
46for (let index = 0; index < regionSettings.length; index++) {
47    const regionSetting = regionSettings[index];
48    const consentRegionData = {
49        ad_storage: regionSetting.advertisement,
50        analytics_storage: regionSetting.analytics,
51        functionality_storage: regionSetting.functional,
52        personalization_storage: regionSetting.functional,
53        security_storage: regionSetting.necessary,
54        ad_user_data: regionSetting.ad_user_data,
55        ad_personalization: regionSetting.ad_personalization
56    };
57    const regionsToSetFor = regionSetting.regions
58        .split(",")
59        .map((region) => region.trim())
60        .filter((region) => region);
61    if (regionsToSetFor.length > 0 && regionsToSetFor[0].toLowerCase() !== "all")
62        consentRegionData.region = regionsToSetFor;
63    else setDefaultSetting = false;
64    setConsentInitStates(consentRegionData);
65}
66
67if (setDefaultSetting) {
68    setConsentInitStates({
69      ad_storage: "denied",
70      analytics_storage: "denied",
71      functionality_storage: "denied",
72      personalization_storage: "denied",
73      security_storage: "granted",
74      ad_user_data: "denied",
75      ad_personalization: "denied"
76    });
77}
78
79const consentString = getCookieValues("cookieyes-consent")[0];
80if (consentString && typeof consentString === "string") {
81    const cookieObj = consentString.split(",").reduce(function (acc, curr) {
82        const cookieValue = curr.trim().split(":");
83        acc[cookieValue[0]] = getConsentStateForCategory(cookieValue[1]);
84        return acc;
85    }, {});
86    
87    function updateConsentState(consentState) {
88        gtag("consent", "update", consentState);
89    }
90
91  updateConsentState({
92    ad_storage: cookieObj.advertisement,
93    analytics_storage: cookieObj.analytics,
94    functionality_storage: cookieObj.functional,
95    personalization_storage: cookieObj.functional,
96    security_storage: cookieObj.necessary,
97    ad_user_data: cookieObj.advertisement,
98    ad_personalization: cookieObj.advertisement,
99  });
100}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.