China unexpectedly cancels top EU diplomat’s Beijing visit s.trim()) .find((s) => s.startsWith(cookieName)); }, fetchRegion: function() { fetch(‘https://geo.cnbc.com/info/’) .then(response => response.json()) .then(data => { if (data && data.geo && data.geo.country_code) { if(EEA_REGION_COUNTRY_CODES.includes(data.geo.country_code)) { initiateComscore.pushData(‘0’); } else { initiateComscore.pushData(”); } } }); }, run: function() { if (!Object.values(OneTrustCategories).includes(7)) { throw new Error(‘OneTrust category not found.’); } var optanonCookie = initiateComscore.getCookie(‘OptanonConsent’); var usPrivacyCookie = initiateComscore.getCookie(‘USPrivacy’); var regionCookie = initiateComscore.getCookie(‘region’); // check if regionCookie is present if not fetch region and update cs_ucfr value; if (regionCookie) { // if region is USA check for USPrivacy Cookie if (regionCookie.split(‘=’)[1] === ‘USA’) { var usPrivacyCookieValue = usPrivacyCookie && usPrivacyCookie.split(‘=’)[1]; if (optanonCookie || usPrivacyCookieValue) { if (usPrivacyCookieValue === ‘1YYN’) { initiateComscore.pushData(‘0’); } else if (usPrivacyCookieValue === ‘1YNN’) { initiateComscore.pushData(‘1’); } else { // if USPrivacy cookie is not present initiateComscore.pushData(‘1’); } } else { initiateComscore.fetchRegion(); } } else { // If region is not USA check for OptanonCookie if (optanonCookie) { var categoryRegex = /groups=[^&]*%2C7%3A([01])/; var regexResults = optanonCookie.match(categoryRegex); if (regexResults && regexResults[1]) { initiateComscore.pushData(regexResults[1]); } else { initiateComscore.pushData(‘0’); } } else { initiateComscore.fetchRegion(); } } } else { initiateComscore.fetchRegion(); } } }; //Run COMSCORE initiateComscore.run(); ]]>
Read The Full Article Here