Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
Cookie Consent behind flag
Browse files Browse the repository at this point in the history
 🐿 v2.8.0
  • Loading branch information
andrewgeorgiou1981 committed May 21, 2018
1 parent b6a85ba commit 737c0c1
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions components/n-ui/ads/js/oAdsConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@ module.exports = function (flags, appName, adOptions) {
adOptions = adOptions || {};

function setCookieConsentOpts (){
//Derive Consent options from cookie banner cookie
let consentString = cookieStore.get('ft-cookie-consent');
if (consentString) {
const consents = consentString.split(',').reduce((acc, consentExpression) => {
const [flag, state] = consentExpression.split(':');
if (flag && state) {
acc[flag] = state === 'on';
}
return acc;
}, {});
if (consents){
adOptions.behavioral = consents.behaviouraladsOnsite;
adOptions.programmatic = consents.programmaticAdsOnsite ? 'y' : 'n';
};
}

adOptions.programmatic = 'n';
adOptions.behavioral = false;
//Derive Consent options from cookie banner cookie
let consentString = cookieStore.get('ft-cookie-consent');
if (consentString) {
const consents = consentString.split(',').reduce((acc, consentExpression) => {
const [flag, state] = consentExpression.split(':');
if (flag && state) {
acc[flag] = state === 'on';
}
return acc;
}, {});
if (consents){
adOptions.behavioral = consents.behaviouraladsOnsite;
adOptions.programmatic = consents.programmaticAdsOnsite ? 'y' : 'n';
};
}
}

if (flags.get('manageAdsCookies')) {
Expand All @@ -35,8 +36,6 @@ module.exports = function (flags, appName, adOptions) {
adOptions.behavioral = true;
}



const targeting = extend({
pt: appName.toLowerCase().substr(0, 3),
nlayout: utils.getLayoutName(),
Expand All @@ -53,7 +52,6 @@ const kruxConfig = (flags.get('krux')) && (!adOptions.noTargeting && adOptions.b
}
};


const validateAdsTrafficApi = ((flags.get('validateAdsTraffic') && flags.get('validateAdsTraffic')==='variant')) ? `${apiUrlRoot}validate-traffic` : null;

function getContextualTargeting (appName) {
Expand Down

0 comments on commit 737c0c1

Please sign in to comment.