Skip to content

Commit

Permalink
Remove references to deprecated cookies (prebid#9619)
Browse files Browse the repository at this point in the history
  • Loading branch information
afewcc authored Mar 3, 2023
1 parent accf28a commit 8112adf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 46 deletions.
29 changes: 0 additions & 29 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ const PUBLISHER_TAG_URL_TEMPLATE = 'https://static.criteo.net/js/ld/publishertag
const FAST_BID_PUBKEY_E = 65537;
const FAST_BID_PUBKEY_N = 'ztQYwCE5BU7T9CDM5he6rKoabstXRmkzx54zFPZkWbK530dwtLBDeaWBMxHBUT55CYyboR/EZ4efghPi3CoNGfGWezpjko9P6p2EwGArtHEeS4slhu/SpSIFMjG6fdrpRoNuIAMhq1Z+Pr/+HOd1pThFKeGFr2/NhtAg+TXAzaU=';

const SID_COOKIE_NAME = 'cto_sid';
const IDCPY_COOKIE_NAME = 'cto_idcpy';
const LWID_COOKIE_NAME = 'cto_lwid';
const OPTOUT_COOKIE_NAME = 'cto_optout';
const BUNDLE_COOKIE_NAME = 'cto_bundle';
const GUID_RETENTION_TIME_HOUR = 24 * 30 * 13; // 13 months
Expand Down Expand Up @@ -78,15 +75,12 @@ export const spec = {
const jsonHash = {
bundle: readFromAllStorages(BUNDLE_COOKIE_NAME),
cw: storage.cookiesAreEnabled(),
localWebId: readFromAllStorages(LWID_COOKIE_NAME),
lsw: storage.localStorageIsEnabled(),
optoutCookie: readFromAllStorages(OPTOUT_COOKIE_NAME),
origin: origin,
requestId: requestId,
secureIdCookie: readFromAllStorages(SID_COOKIE_NAME),
tld: refererInfo.domain,
topUrl: refererInfo.domain,
uid: readFromAllStorages(IDCPY_COOKIE_NAME),
version: '$prebid.version$'.replace(/\./g, '_'),
};

Expand All @@ -106,26 +100,13 @@ export const spec = {
const response = event.data;

if (response.optout) {
deleteFromAllStorages(IDCPY_COOKIE_NAME);
deleteFromAllStorages(SID_COOKIE_NAME);
deleteFromAllStorages(BUNDLE_COOKIE_NAME);
deleteFromAllStorages(LWID_COOKIE_NAME);

saveOnAllStorages(OPTOUT_COOKIE_NAME, true, OPTOUT_RETENTION_TIME_HOUR);
} else {
if (response.uid) {
saveOnAllStorages(IDCPY_COOKIE_NAME, response.uid, GUID_RETENTION_TIME_HOUR);
}

if (response.bundle) {
saveOnAllStorages(BUNDLE_COOKIE_NAME, response.bundle, GUID_RETENTION_TIME_HOUR);
}

if (response.removeSid) {
deleteFromAllStorages(SID_COOKIE_NAME);
} else if (response.sid) {
saveOnAllStorages(SID_COOKIE_NAME, response.sid, GUID_RETENTION_TIME_HOUR);
}
}
}, true);

Expand Down Expand Up @@ -407,16 +388,6 @@ function buildCdbUrl(context) {
url += `&optout=1`;
}

const sid = readFromAllStorages(SID_COOKIE_NAME);
if (sid) {
url += `&sid=${sid}`;
}

const idcpy = readFromAllStorages(IDCPY_COOKIE_NAME);
if (idcpy) {
url += `&idcpy=${idcpy}`;
}

return url;
}

Expand Down
19 changes: 2 additions & 17 deletions test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import {
ADAPTER_VERSION,
canFastBid, getFastBidUrl, FAST_BID_VERSION_CURRENT
} from 'modules/criteoBidAdapter.js';
import { createBid } from 'src/bidfactory.js';
import CONSTANTS from 'src/constants.json';
import * as utils from 'src/utils.js';
import * as refererDetection from 'src/refererDetection.js';
import { config } from '../../../src/config.js';
import * as storageManager from 'src/storageManager.js';
import { BANNER, NATIVE, VIDEO } from '../../../src/mediaTypes.js';

describe('The Criteo bidding adapter', function () {
Expand Down Expand Up @@ -128,19 +125,13 @@ describe('The Criteo bidding adapter', function () {
it('forwards ids from cookies', function () {
const cookieData = {
'cto_bundle': 'a',
'cto_sid': 'b',
'cto_lwid': 'c',
'cto_idcpy': 'd',
'cto_optout': 'e'
'cto_optout': 'b'
};

const expectedHashWithCookieData = {
...expectedHash,
...{
bundle: cookieData['cto_bundle'],
localWebId: cookieData['cto_lwid'],
secureIdCookie: cookieData['cto_sid'],
uid: cookieData['cto_idcpy'],
optoutCookie: cookieData['cto_optout']
}
};
Expand All @@ -158,19 +149,13 @@ describe('The Criteo bidding adapter', function () {
it('forwards ids from local storage', function () {
const localStorageData = {
'cto_bundle': 'a',
'cto_sid': 'b',
'cto_lwid': 'c',
'cto_idcpy': 'd',
'cto_optout': 'e'
'cto_optout': 'b'
};

const expectedHashWithLocalStorageData = {
...expectedHash,
...{
bundle: localStorageData['cto_bundle'],
localWebId: localStorageData['cto_lwid'],
secureIdCookie: localStorageData['cto_sid'],
uid: localStorageData['cto_idcpy'],
optoutCookie: localStorageData['cto_optout']
}
};
Expand Down

0 comments on commit 8112adf

Please sign in to comment.