Skip to content

Commit

Permalink
remove digitrust from rubicon bid adapter (#5798)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrmartinez authored Oct 5, 2020
1 parent 907a9c7 commit b5cf481
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 282 deletions.
55 changes: 0 additions & 55 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ config.getConfig('rubicon', config => {
});

const GVLID = 52;
const DIGITRUST_PROP_NAMES = {
FASTLANE: {
id: 'dt.id',
keyv: 'dt.keyv',
pref: 'dt.pref'
},
PREBID_SERVER: {
id: 'id',
keyv: 'keyv'
}
};

var sizeMap = {
1: '468x60',
Expand Down Expand Up @@ -230,11 +219,6 @@ export const spec = {

addVideoParameters(data, bidRequest);

const digiTrust = _getDigiTrustQueryParams(bidRequest, 'PREBID_SERVER');
if (digiTrust) {
utils.deepSetValue(data, 'user.ext.digitrust', digiTrust);
}

if (bidderRequest.gdprConsent) {
// note - gdprApplies & consentString may be undefined in certain use-cases for consentManagement module
let gdprApplies;
Expand Down Expand Up @@ -405,9 +389,6 @@ export const spec = {
'tpid_tdid',
'tpid_liveintent.com',
'tg_v.LIseg',
'dt.id',
'dt.keyv',
'dt.pref',
'rf',
'p_geo.latitude',
'p_geo.longitude',
Expand Down Expand Up @@ -617,10 +598,6 @@ export const spec = {
data['tg_i.dfp_ad_unit_code'] = gamAdUnit.replace(/^\/+/, '');
}

// digitrust properties
const digitrustParams = _getDigiTrustQueryParams(bidRequest, 'FASTLANE');
Object.assign(data, digitrustParams);

if (config.getConfig('coppa') === true) {
data['coppa'] = 1;
}
Expand Down Expand Up @@ -852,38 +829,6 @@ function _getScreenResolution() {
return [window.screen.width, window.screen.height].join('x');
}

function _getDigiTrustQueryParams(bidRequest = {}, endpointName) {
if (!endpointName || !DIGITRUST_PROP_NAMES[endpointName]) {
return null;
}
const propNames = DIGITRUST_PROP_NAMES[endpointName];

function getDigiTrustId() {
const bidRequestDigitrust = utils.deepAccess(bidRequest, 'userId.digitrustid.data');
if (bidRequestDigitrust) {
return bidRequestDigitrust;
}

let digiTrustUser = (window.DigiTrust && (config.getConfig('digiTrustId') || window.DigiTrust.getUser({member: 'T9QSFKPDN9'})));
return (digiTrustUser && digiTrustUser.success && digiTrustUser.identity) || null;
}

let digiTrustId = getDigiTrustId();
// Verify there is an ID and this user has not opted out
if (!digiTrustId || (digiTrustId.privacy && digiTrustId.privacy.optout)) {
return null;
}

const digiTrustQueryParams = {
[propNames.id]: digiTrustId.id,
[propNames.keyv]: digiTrustId.keyv
};
if (propNames.pref) {
digiTrustQueryParams[propNames.pref] = 0;
}
return digiTrustQueryParams;
}

/**
* @param {BidRequest} bidRequest
* @param bidderRequest
Expand Down
227 changes: 0 additions & 227 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,233 +702,6 @@ describe('the rubicon adapter', function () {
expect(data['rp_floor']).to.equal('2');
});

it('should send digitrust params', function () {
window.DigiTrust = {
getUser: function () {
}
};
sandbox.stub(window.DigiTrust, 'getUser').callsFake(() =>
({
success: true,
identity: {
privacy: {optout: false},
id: 'testId',
keyv: 'testKeyV'
}
})
);

let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

let expectedQuery = {
'dt.id': 'testId',
'dt.keyv': 'testKeyV',
'dt.pref': '0'
};

// test that all values above are both present and correct
Object.keys(expectedQuery).forEach(key => {
let value = expectedQuery[key];
expect(data[key]).to.equal(value);
});

delete window.DigiTrust;
});

it('should not send digitrust params when DigiTrust not loaded', function () {
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

let undefinedKeys = ['dt.id', 'dt.keyv'];

// Test that none of the DigiTrust keys are part of the query
undefinedKeys.forEach(key => {
expect(typeof data[key]).to.equal('undefined');
});
});

it('should not send digitrust params due to optout', function () {
window.DigiTrust = {
getUser: function () {
}
};
sandbox.stub(window.DigiTrust, 'getUser').callsFake(() =>
({
success: true,
identity: {
privacy: {optout: true},
id: 'testId',
keyv: 'testKeyV'
}
})
);

let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

let undefinedKeys = ['dt.id', 'dt.keyv'];

// Test that none of the DigiTrust keys are part of the query
undefinedKeys.forEach(key => {
expect(typeof data[key]).to.equal('undefined');
});

delete window.DigiTrust;
});

it('should not send digitrust params due to failure', function () {
window.DigiTrust = {
getUser: function () {
}
};
sandbox.stub(window.DigiTrust, 'getUser').callsFake(() =>
({
success: false,
identity: {
privacy: {optout: false},
id: 'testId',
keyv: 'testKeyV'
}
})
);

let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

let undefinedKeys = ['dt.id', 'dt.keyv'];

// Test that none of the DigiTrust keys are part of the query
undefinedKeys.forEach(key => {
expect(typeof data[key]).to.equal('undefined');
});

delete window.DigiTrust;
});

describe('digiTrustId config', function () {
beforeEach(function () {
window.DigiTrust = {
getUser: sandbox.spy()
};
});

afterEach(function () {
delete window.DigiTrust;
});

it('should send digiTrustId config params', function () {
sandbox.stub(config, 'getConfig').callsFake((key) => {
var config = {
digiTrustId: {
success: true,
identity: {
privacy: {optout: false},
id: 'testId',
keyv: 'testKeyV'
}
}
};
return config[key];
});

let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

let expectedQuery = {
'dt.id': 'testId',
'dt.keyv': 'testKeyV'
};

// test that all values above are both present and correct
Object.keys(expectedQuery).forEach(key => {
let value = expectedQuery[key];
expect(data[key]).to.equal(value);
});

// should not have called DigiTrust.getUser()
expect(window.DigiTrust.getUser.notCalled).to.equal(true);
});

it('should not send digiTrustId config params due to optout', function () {
sandbox.stub(config, 'getConfig').callsFake((key) => {
var config = {
digiTrustId: {
success: true,
identity: {
privacy: {optout: true},
id: 'testId',
keyv: 'testKeyV'
}
}
}
return config[key];
});

let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

let undefinedKeys = ['dt.id', 'dt.keyv'];

// Test that none of the DigiTrust keys are part of the query
undefinedKeys.forEach(key => {
expect(typeof data[key]).to.equal('undefined');
});

// should not have called DigiTrust.getUser()
expect(window.DigiTrust.getUser.notCalled).to.equal(true);
});

it('should not send digiTrustId config params due to failure', function () {
sandbox.stub(config, 'getConfig').callsFake((key) => {
var config = {
digiTrustId: {
success: false,
identity: {
privacy: {optout: false},
id: 'testId',
keyv: 'testKeyV'
}
}
}
return config[key];
});

let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

let undefinedKeys = ['dt.id', 'dt.keyv'];

// Test that none of the DigiTrust keys are part of the query
undefinedKeys.forEach(key => {
expect(typeof data[key]).to.equal('undefined');
});

// should not have called DigiTrust.getUser()
expect(window.DigiTrust.getUser.notCalled).to.equal(true);
});

it('should not send digiTrustId config params if they do not exist', function () {
sandbox.stub(config, 'getConfig').callsFake((key) => {
var config = {};
return config[key];
});

let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let data = parseQuery(request.data);

let undefinedKeys = ['dt.id', 'dt.keyv'];

// Test that none of the DigiTrust keys are part of the query
undefinedKeys.forEach(key => {
expect(typeof data[key]).to.equal('undefined');
});

// should have called DigiTrust.getUser() once
expect(window.DigiTrust.getUser.calledOnce).to.equal(true);
});
});

describe('GDPR consent config', function () {
it('should send "gdpr" and "gdpr_consent", when gdprConsent defines consentString and gdprApplies', function () {
createGdprBidderRequest(true);
Expand Down

0 comments on commit b5cf481

Please sign in to comment.