prebid.js 6.26.0 → 6.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/adWMGAnalyticsAdapter.js +1 -1
- package/dist/adagioAnalyticsAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adfBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adkernelAdnAnalyticsAdapter.js +1 -1
- package/dist/adlooxAdServerVideo.js +1 -1
- package/dist/adlooxAnalyticsAdapter.js +1 -1
- package/dist/adlooxRtdProvider.js +1 -1
- package/dist/adoceanBidAdapter.js +1 -1
- package/dist/adomikAnalyticsAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adxcgAnalyticsAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adxpremiumAnalyticsAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/akamaiDapRtdProvider.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/atsAnalyticsAdapter.js +1 -1
- package/dist/audiencerunBidAdapter.js +1 -1
- package/dist/automatadBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/bidwatchAnalyticsAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bluebillywigBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/byDataAnalyticsAdapter.js +1 -1
- package/dist/colossussspBidAdapter.js +1 -1
- package/dist/concertAnalyticsAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/datablocksAnalyticsAdapter.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningAnalyticsAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/fintezaAnalyticsAdapter.js +1 -1
- package/dist/ftrackIdSystem.js +1 -1
- package/dist/gdprEnforcement.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hadronAnalyticsAdapter.js +1 -1
- package/dist/hadronRtdProvider.js +1 -1
- package/dist/id5AnalyticsAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/impactifyBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/incrxBidAdapter.js +1 -0
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/inskinBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/invisiblyAnalyticsAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/jixieBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoAnalyticsAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/koblerBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/livewrappedAnalyticsAdapter.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/mantisBidAdapter.js +1 -1
- package/dist/marsmediaAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediakeysBidAdapter.js +1 -1
- package/dist/medianetAnalyticsAdapter.js +1 -1
- package/dist/medianetBidAdapter.js +1 -1
- package/dist/medianetRtdProvider.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/merkleIdSystem.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/naveggIdSystem.js +1 -1
- package/dist/not-for-prod/prebid.js +178 -176
- package/dist/novatiqIdSystem.js +1 -1
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/oneVideoBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxAnalyticsAdapter.js +1 -1
- package/dist/optimonAnalyticsAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +3 -3
- package/dist/prebidmanagerAnalyticsAdapter.js +1 -1
- package/dist/pubCommonId.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticAnalyticsAdapter.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubperfAnalyticsAdapter.js +1 -1
- package/dist/pubstackAnalyticsAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pubxaiAnalyticsAdapter.js +1 -1
- package/dist/pulsepointAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/realvuAnalyticsAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/relevantAnalyticsAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rivrAnalyticsAdapter.js +1 -1
- package/dist/roxotAnalyticsAdapter.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/scaleableAnalyticsAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharedIdSystem.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/sigmoidAnalyticsAdapter.js +1 -1
- package/dist/slimcutBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiAnalyticsAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sortableAnalyticsAdapter.js +1 -1
- package/dist/sortableBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/spotxBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/staqAnalyticsAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.js +1 -0
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/telariaBidAdapter.js +1 -1
- package/dist/terceptAnalyticsAdapter.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/trustxBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/userId.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/dist/yuktamediaAnalyticsAdapter.js +1 -1
- package/dist/zeta_global_sspAnalyticsAdapter.js +1 -1
- package/dist/zeta_global_sspBidAdapter.js +1 -1
- package/integrationExamples/gpt/akamaidap_segments_example.html +5 -3
- package/modules/.submodules.json +1 -0
- package/modules/adfBidAdapter.js +0 -3
- package/modules/adlooxAnalyticsAdapter.js +9 -5
- package/modules/adlooxAnalyticsAdapter.md +3 -3
- package/modules/adlooxRtdProvider.js +3 -5
- package/modules/adlooxRtdProvider.md +2 -2
- package/modules/adoceanBidAdapter.js +29 -1
- package/modules/adyoulikeBidAdapter.js +3 -0
- package/modules/akamaiDapRtdProvider.js +469 -139
- package/modules/akamaiDapRtdProvider.md +5 -3
- package/modules/automatadBidAdapter.js +9 -5
- package/modules/colossussspBidAdapter.js +17 -17
- package/modules/conversantBidAdapter.js +2 -2
- package/modules/criteoBidAdapter.js +1 -1
- package/modules/ftrackIdSystem.js +5 -8
- package/modules/gdprEnforcement.js +15 -9
- package/modules/gridBidAdapter.js +4 -0
- package/modules/hadronAnalyticsAdapter.js +5 -1
- package/modules/hadronRtdProvider.js +15 -13
- package/modules/incrxBidAdapter.js +87 -0
- package/modules/{vertozBidAdapter.md → incrxBidAdapter.md} +6 -6
- package/modules/inskinBidAdapter.js +4 -3
- package/modules/insticatorBidAdapter.js +109 -42
- package/modules/ixBidAdapter.js +3 -2
- package/modules/ixBidAdapter.md +1 -1
- package/modules/kargoBidAdapter.js +32 -1
- package/modules/koblerBidAdapter.js +54 -45
- package/modules/koblerBidAdapter.md +12 -17
- package/modules/mantisBidAdapter.js +4 -8
- package/modules/medianetBidAdapter.js +2 -2
- package/modules/medianetRtdProvider.js +4 -6
- package/modules/merkleIdSystem.js +43 -31
- package/modules/naveggIdSystem.js +3 -2
- package/modules/novatiqIdSystem.js +6 -1
- package/modules/pubCommonId.js +2 -1
- package/modules/pubmaticAnalyticsAdapter.js +49 -33
- package/modules/relaidoBidAdapter.js +0 -3
- package/modules/sharedIdSystem.js +5 -11
- package/modules/slimcutBidAdapter.js +2 -2
- package/modules/spotxBidAdapter.js +1 -1
- package/modules/synacormediaBidAdapter.js +11 -2
- package/modules/taboolaBidAdapter.js +265 -0
- package/modules/taboolaBidAdapter.md +49 -0
- package/modules/telariaBidAdapter.js +3 -3
- package/modules/userId/eids.js +25 -5
- package/modules/zeta_global_sspBidAdapter.js +3 -2
- package/package.json +1 -1
- package/src/AnalyticsAdapter.js +5 -1
- package/src/adloader.js +6 -1
- package/src/storageManager.js +5 -4
- package/test/mocks/analyticsStub.js +13 -0
- package/test/mocks/xhr.js +22 -0
- package/test/spec/AnalyticsAdapter_spec.js +4 -0
- package/test/spec/modules/adfBidAdapter_spec.js +1 -1
- package/test/spec/modules/adoceanBidAdapter_spec.js +25 -1
- package/test/spec/modules/adriverIdSystem_spec.js +7 -3
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +16 -1
- package/test/spec/modules/akamaiDapRtdProvider_spec.js +457 -109
- package/test/spec/modules/automatadBidAdapter_spec.js +4 -0
- package/test/spec/modules/conversantBidAdapter_spec.js +36 -5
- package/test/spec/modules/datablocksBidAdapter_spec.js +9 -8
- package/test/spec/modules/eids_spec.js +48 -3
- package/test/spec/modules/fintezaAnalyticsAdapter_spec.js +4 -4
- package/test/spec/modules/ftrackIdSystem_spec.js +11 -22
- package/test/spec/modules/gdprEnforcement_spec.js +100 -53
- package/test/spec/modules/gridBidAdapter_spec.js +11 -0
- package/test/spec/modules/incrxBidAdapter_spec.js +100 -0
- package/test/spec/modules/insticatorBidAdapter_spec.js +46 -1
- package/test/spec/modules/ixBidAdapter_spec.js +1 -1
- package/test/spec/modules/kargoBidAdapter_spec.js +27 -0
- package/test/spec/modules/koblerBidAdapter_spec.js +160 -124
- package/test/spec/modules/medianetRtdProvider_spec.js +146 -0
- package/test/spec/modules/merkleIdSystem_spec.js +58 -37
- package/test/spec/modules/naveggIdSystem_spec.js +25 -1
- package/test/spec/modules/proxistoreBidAdapter_spec.js +0 -2
- package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +117 -0
- package/test/spec/modules/sovrnBidAdapter_spec.js +253 -264
- package/test/spec/modules/synacormediaBidAdapter_spec.js +74 -0
- package/test/spec/modules/taboolaBidAdapter_spec.js +455 -0
- package/test/spec/modules/userId_spec.js +27 -1
- package/test/spec/modules/vidazooBidAdapter_spec.js +9 -4
- package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +4 -2
- package/test/test_deps.js +1 -0
|
@@ -1362,4 +1362,78 @@ describe('synacormediaBidAdapter ', function () {
|
|
|
1362
1362
|
expect(videoRequest.data.imp[0].bidfloor).to.equal(priceModuleFloor);
|
|
1363
1363
|
});
|
|
1364
1364
|
});
|
|
1365
|
+
|
|
1366
|
+
describe('Bid Requests with gpid or anything in bid.ext should use if available', function () {
|
|
1367
|
+
let validVideoBidRequest = {
|
|
1368
|
+
bidder: 'synacormedia',
|
|
1369
|
+
params: {
|
|
1370
|
+
seatId: 'prebid',
|
|
1371
|
+
placementId: 'demo1',
|
|
1372
|
+
pos: 1,
|
|
1373
|
+
video: {}
|
|
1374
|
+
},
|
|
1375
|
+
renderer: {
|
|
1376
|
+
url: '../syncOutstreamPlayer.js'
|
|
1377
|
+
},
|
|
1378
|
+
ortb2Imp: {
|
|
1379
|
+
ext: {
|
|
1380
|
+
gpid: '/1111/homepage-video',
|
|
1381
|
+
data: {
|
|
1382
|
+
pbadslot: '/1111/homepage-video'
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
mediaTypes: {
|
|
1387
|
+
video: {
|
|
1388
|
+
playerSize: [[300, 250]],
|
|
1389
|
+
context: 'outstream'
|
|
1390
|
+
}
|
|
1391
|
+
},
|
|
1392
|
+
adUnitCode: 'div-1',
|
|
1393
|
+
transactionId: '0869f34e-090b-4b20-84ee-46ff41405a39',
|
|
1394
|
+
sizes: [[300, 250]],
|
|
1395
|
+
bidId: '22b3a2268d9f0e',
|
|
1396
|
+
bidderRequestId: '1d195910597e13',
|
|
1397
|
+
auctionId: '3375d336-2aea-4ee7-804c-6d26b621ad20',
|
|
1398
|
+
src: 'client',
|
|
1399
|
+
bidRequestsCount: 1,
|
|
1400
|
+
bidderRequestsCount: 1,
|
|
1401
|
+
bidderWinsCount: 0
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
let validBannerBidRequest = {
|
|
1405
|
+
bidId: '9876abcd',
|
|
1406
|
+
sizes: [[300, 250]],
|
|
1407
|
+
params: {
|
|
1408
|
+
seatId: 'prebid',
|
|
1409
|
+
placementId: '1234',
|
|
1410
|
+
},
|
|
1411
|
+
ortb2Imp: {
|
|
1412
|
+
ext: {
|
|
1413
|
+
gpid: '/1111/homepage-banner',
|
|
1414
|
+
data: {
|
|
1415
|
+
pbadslot: '/1111/homepage-banner'
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
let bidderRequest = {
|
|
1422
|
+
refererInfo: {
|
|
1423
|
+
referer: 'http://localhost:9999/'
|
|
1424
|
+
},
|
|
1425
|
+
bidderCode: 'synacormedia',
|
|
1426
|
+
auctionId: 'f8a75621-d672-4cbb-9275-3db7d74fb110'
|
|
1427
|
+
};
|
|
1428
|
+
|
|
1429
|
+
it('should return valid gpid and pbadslot', function () {
|
|
1430
|
+
let videoRequest = spec.buildRequests([validVideoBidRequest], bidderRequest);
|
|
1431
|
+
let bannerRequest = spec.buildRequests([validBannerBidRequest], bidderRequest);
|
|
1432
|
+
|
|
1433
|
+
expect(videoRequest.data.imp[0].ext.gpid).to.equal('/1111/homepage-video');
|
|
1434
|
+
expect(videoRequest.data.imp[0].ext.data.pbadslot).to.equal('/1111/homepage-video');
|
|
1435
|
+
expect(bannerRequest.data.imp[0].ext.gpid).to.equal('/1111/homepage-banner');
|
|
1436
|
+
expect(bannerRequest.data.imp[0].ext.data.pbadslot).to.equal('/1111/homepage-banner');
|
|
1437
|
+
});
|
|
1438
|
+
});
|
|
1365
1439
|
});
|
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {spec, internal, END_POINT_URL, userData} from 'modules/taboolaBidAdapter.js';
|
|
3
|
+
import {config} from '../../../src/config'
|
|
4
|
+
import * as utils from '../../../src/utils'
|
|
5
|
+
|
|
6
|
+
describe('Taboola Adapter', function () {
|
|
7
|
+
let hasLocalStorage, cookiesAreEnabled, getDataFromLocalStorage, localStorageIsEnabled, getCookie;
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
hasLocalStorage = sinon.stub(userData.storageManager, 'hasLocalStorage');
|
|
11
|
+
cookiesAreEnabled = sinon.stub(userData.storageManager, 'cookiesAreEnabled');
|
|
12
|
+
getCookie = sinon.stub(userData.storageManager, 'getCookie');
|
|
13
|
+
getDataFromLocalStorage = sinon.stub(userData.storageManager, 'getDataFromLocalStorage');
|
|
14
|
+
localStorageIsEnabled = sinon.stub(userData.storageManager, 'localStorageIsEnabled');
|
|
15
|
+
|
|
16
|
+
$$PREBID_GLOBAL$$.bidderSettings = {
|
|
17
|
+
taboola: {
|
|
18
|
+
storageAllowed: true
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
hasLocalStorage.restore();
|
|
25
|
+
cookiesAreEnabled.restore();
|
|
26
|
+
getCookie.restore();
|
|
27
|
+
getDataFromLocalStorage.restore();
|
|
28
|
+
localStorageIsEnabled.restore();
|
|
29
|
+
|
|
30
|
+
$$PREBID_GLOBAL$$.bidderSettings = {};
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const commonBidRequest = {
|
|
34
|
+
bidder: 'taboola',
|
|
35
|
+
params: {
|
|
36
|
+
publisherId: 'publisherId',
|
|
37
|
+
tagId: 'placement name'
|
|
38
|
+
},
|
|
39
|
+
bidId: 'aa43860a-4644-442a-b5e0-93f268cs4d19',
|
|
40
|
+
auctionId: '65746dca-26f3-4186-be13-dfa63469b1b7',
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const displayBidRequestParams = {
|
|
44
|
+
sizes: [[300, 250], [300, 600]]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe('isBidRequestValid', function () {
|
|
48
|
+
it('should fail when bid is invalid - tagId isn`t defined', function () {
|
|
49
|
+
const bid = {
|
|
50
|
+
bidder: 'taboola',
|
|
51
|
+
params: {
|
|
52
|
+
publisherId: 'publisherId'
|
|
53
|
+
},
|
|
54
|
+
...displayBidRequestParams
|
|
55
|
+
}
|
|
56
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('should fail when bid is invalid - publisherId isn`t defined', function () {
|
|
60
|
+
const bid = {
|
|
61
|
+
bidder: 'taboola',
|
|
62
|
+
params: {
|
|
63
|
+
tagId: 'below the article'
|
|
64
|
+
},
|
|
65
|
+
...displayBidRequestParams
|
|
66
|
+
}
|
|
67
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('should fail when bid is invalid - sizes isn`t defined', function () {
|
|
71
|
+
const bid = {
|
|
72
|
+
bidder: 'taboola',
|
|
73
|
+
params: {
|
|
74
|
+
publisherId: 'publisherId',
|
|
75
|
+
tagId: 'below the article'
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('should succeed when bid contains valid', function () {
|
|
82
|
+
const bid = {
|
|
83
|
+
bidder: 'taboola',
|
|
84
|
+
params: {
|
|
85
|
+
publisherId: 'publisherId',
|
|
86
|
+
tagId: 'below the article'
|
|
87
|
+
},
|
|
88
|
+
...displayBidRequestParams,
|
|
89
|
+
}
|
|
90
|
+
expect(spec.isBidRequestValid(bid)).to.equal(true)
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
describe('buildRequests', function () {
|
|
95
|
+
const defaultBidRequest = {
|
|
96
|
+
...commonBidRequest,
|
|
97
|
+
...displayBidRequestParams,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const commonBidderRequest = {
|
|
101
|
+
refererInfo: {
|
|
102
|
+
referer: 'https://example.com/ref',
|
|
103
|
+
canonicalUrl: 'https://example.com/'
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
it('should build display request', function () {
|
|
108
|
+
const expectedData = {
|
|
109
|
+
'imp': [{
|
|
110
|
+
'id': 1,
|
|
111
|
+
'banner': {
|
|
112
|
+
format: [{
|
|
113
|
+
w: displayBidRequestParams.sizes[0][0],
|
|
114
|
+
h: displayBidRequestParams.sizes[0][1]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
w: displayBidRequestParams.sizes[1][0],
|
|
118
|
+
h: displayBidRequestParams.sizes[1][1]
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
'tagid': commonBidRequest.params.tagId,
|
|
123
|
+
'bidfloor': null,
|
|
124
|
+
'bidfloorcur': 'USD'
|
|
125
|
+
}],
|
|
126
|
+
'site': {
|
|
127
|
+
'id': commonBidRequest.params.publisherId,
|
|
128
|
+
'name': commonBidRequest.params.publisherId,
|
|
129
|
+
'domain': window.location.host,
|
|
130
|
+
'page': commonBidderRequest.refererInfo.canonicalUrl,
|
|
131
|
+
'ref': commonBidderRequest.refererInfo.referer,
|
|
132
|
+
'publisher': {'id': commonBidRequest.params.publisherId},
|
|
133
|
+
'content': {'language': navigator.language}
|
|
134
|
+
},
|
|
135
|
+
'device': {'ua': navigator.userAgent},
|
|
136
|
+
'source': {'fd': 1},
|
|
137
|
+
'bcat': [],
|
|
138
|
+
'badv': [],
|
|
139
|
+
'user': {
|
|
140
|
+
'buyeruid': 0,
|
|
141
|
+
'ext': {},
|
|
142
|
+
},
|
|
143
|
+
'regs': {'coppa': 0, 'ext': {}}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const res = spec.buildRequests([defaultBidRequest], commonBidderRequest);
|
|
147
|
+
|
|
148
|
+
expect(res.url).to.equal(`${END_POINT_URL}/${commonBidRequest.params.publisherId}`);
|
|
149
|
+
expect(res.data).to.deep.equal(JSON.stringify(expectedData));
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
it('should pass optional parameters in request', function () {
|
|
153
|
+
const optionalParams = {
|
|
154
|
+
bidfloor: 0.25,
|
|
155
|
+
bidfloorcur: 'EUR'
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const bidRequest = {
|
|
159
|
+
...defaultBidRequest,
|
|
160
|
+
params: {...commonBidRequest.params, ...optionalParams}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const res = spec.buildRequests([bidRequest], commonBidderRequest);
|
|
164
|
+
const resData = JSON.parse(res.data);
|
|
165
|
+
expect(resData.imp[0].bidfloor).to.deep.equal(0.25);
|
|
166
|
+
expect(resData.imp[0].bidfloorcur).to.deep.equal('EUR');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('should pass bidder timeout', function () {
|
|
170
|
+
const bidderRequest = {
|
|
171
|
+
...commonBidderRequest,
|
|
172
|
+
timeout: 500
|
|
173
|
+
}
|
|
174
|
+
const res = spec.buildRequests([defaultBidRequest], bidderRequest);
|
|
175
|
+
const resData = JSON.parse(res.data);
|
|
176
|
+
expect(resData.tmax).to.equal(500);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
describe('handle privacy segments when building request', function () {
|
|
180
|
+
it('should pass GDPR consent', function () {
|
|
181
|
+
const bidderRequest = {
|
|
182
|
+
refererInfo: {
|
|
183
|
+
referer: 'https://example.com/'
|
|
184
|
+
},
|
|
185
|
+
gdprConsent: {
|
|
186
|
+
gdprApplies: true,
|
|
187
|
+
consentString: 'consentString',
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const res = spec.buildRequests([defaultBidRequest], bidderRequest)
|
|
192
|
+
const resData = JSON.parse(res.data)
|
|
193
|
+
expect(resData.user.ext.consent).to.equal('consentString')
|
|
194
|
+
expect(resData.regs.ext.gdpr).to.equal(1)
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('should pass us privacy consent', function () {
|
|
198
|
+
const bidderRequest = {
|
|
199
|
+
refererInfo: {
|
|
200
|
+
referer: 'https://example.com/'
|
|
201
|
+
},
|
|
202
|
+
uspConsent: 'consentString'
|
|
203
|
+
}
|
|
204
|
+
const res = spec.buildRequests([defaultBidRequest], bidderRequest);
|
|
205
|
+
const resData = JSON.parse(res.data);
|
|
206
|
+
expect(resData.regs.ext.us_privacy).to.equal('consentString');
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('should pass coppa consent', function () {
|
|
210
|
+
config.setConfig({coppa: true})
|
|
211
|
+
|
|
212
|
+
const res = spec.buildRequests([defaultBidRequest], commonBidderRequest)
|
|
213
|
+
const resData = JSON.parse(res.data);
|
|
214
|
+
expect(resData.regs.coppa).to.equal(1)
|
|
215
|
+
|
|
216
|
+
config.resetConfig()
|
|
217
|
+
});
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
describe('handle userid ', function () {
|
|
221
|
+
it('should get user id from local storage', function () {
|
|
222
|
+
getDataFromLocalStorage.returns(51525152);
|
|
223
|
+
hasLocalStorage.returns(true);
|
|
224
|
+
localStorageIsEnabled.returns(true);
|
|
225
|
+
|
|
226
|
+
const bidderRequest = {
|
|
227
|
+
...commonBidderRequest,
|
|
228
|
+
timeout: 500
|
|
229
|
+
}
|
|
230
|
+
const res = spec.buildRequests([defaultBidRequest], bidderRequest);
|
|
231
|
+
const resData = JSON.parse(res.data);
|
|
232
|
+
expect(resData.user.buyeruid).to.equal(51525152);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('should get user id from cookie if local storage isn`t defined', function () {
|
|
236
|
+
getDataFromLocalStorage.returns(51525152);
|
|
237
|
+
hasLocalStorage.returns(false);
|
|
238
|
+
localStorageIsEnabled.returns(false);
|
|
239
|
+
cookiesAreEnabled.returns(true);
|
|
240
|
+
getCookie.returns('taboola%20global%3Auser-id=12121212');
|
|
241
|
+
|
|
242
|
+
const bidderRequest = {
|
|
243
|
+
...commonBidderRequest
|
|
244
|
+
};
|
|
245
|
+
const res = spec.buildRequests([defaultBidRequest], bidderRequest);
|
|
246
|
+
const resData = JSON.parse(res.data);
|
|
247
|
+
|
|
248
|
+
expect(resData.user.buyeruid).to.equal('12121212');
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('should get user id from TRC if local storage and cookie isn`t defined', function () {
|
|
252
|
+
hasLocalStorage.returns(false);
|
|
253
|
+
cookiesAreEnabled.returns(false);
|
|
254
|
+
localStorageIsEnabled.returns(false);
|
|
255
|
+
|
|
256
|
+
window.TRC = {
|
|
257
|
+
user_id: 31313132
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const bidderRequest = {
|
|
261
|
+
...commonBidderRequest
|
|
262
|
+
}
|
|
263
|
+
const res = spec.buildRequests([defaultBidRequest], bidderRequest);
|
|
264
|
+
const resData = JSON.parse(res.data);
|
|
265
|
+
expect(resData.user.buyeruid).to.equal(window.TRC.user_id);
|
|
266
|
+
|
|
267
|
+
delete window.TRC;
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('should get user id to be 0 if cookie, local storage, TRC isn`t defined', function () {
|
|
271
|
+
hasLocalStorage.returns(false);
|
|
272
|
+
cookiesAreEnabled.returns(false);
|
|
273
|
+
|
|
274
|
+
const bidderRequest = {
|
|
275
|
+
...commonBidderRequest
|
|
276
|
+
}
|
|
277
|
+
const res = spec.buildRequests([defaultBidRequest], bidderRequest);
|
|
278
|
+
const resData = JSON.parse(res.data);
|
|
279
|
+
expect(resData.user.buyeruid).to.equal(0);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it('should set buyeruid to be 0 if it`s a new user', function () {
|
|
283
|
+
const bidderRequest = {
|
|
284
|
+
...commonBidderRequest
|
|
285
|
+
}
|
|
286
|
+
const res = spec.buildRequests([defaultBidRequest], bidderRequest);
|
|
287
|
+
const resData = JSON.parse(res.data);
|
|
288
|
+
expect(resData.user.buyeruid).to.equal(0);
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
})
|
|
292
|
+
|
|
293
|
+
describe('interpretResponse', function () {
|
|
294
|
+
const serverResponse = {
|
|
295
|
+
body: {
|
|
296
|
+
'id': '49ffg4d58ef9a163a69fhgfghd4fad03621b9e036f24f7_15',
|
|
297
|
+
'seatbid': [
|
|
298
|
+
{
|
|
299
|
+
'bid': [
|
|
300
|
+
{
|
|
301
|
+
'id': '0b3dd94348-134b-435f-8db5-6bf5afgfc39e86c',
|
|
302
|
+
'impid': '1',
|
|
303
|
+
'price': 0.342068,
|
|
304
|
+
'adid': '2785119545551083381',
|
|
305
|
+
'adm': '\u003chtml\u003e\n\u003chead\u003e\n\u003cmeta charset\u003d"UTF-8"\u003e\n\u003cmeta http-equiv\u003d"Content-Type" content\u003d"text/html; charset\u003dutf-8"/\u003e\u003c/head\u003e\n\u003cbody style\u003d"margin: 0px; overflow:hidden;"\u003e \n\u003cscript type\u003d"text/javascript"\u003e\nwindow.tbl_trc_domain \u003d \u0027us-trc.taboola.com\u0027;\nwindow._taboola \u003d window._taboola || [];\n_taboola.push({article:\u0027auto\u0027});\n!function (e, f, u, i) {\nif (!document.getElementById(i)){\ne.async \u003d 1;\ne.src \u003d u;\ne.id \u003d i;\nf.parentNode.insertBefore(e, f);\n}\n}(document.createElement(\u0027script\u0027),\ndocument.getElementsByTagName(\u0027script\u0027)[0],\n\u0027//cdn.taboola.com/libtrc/wattpad-placement-255/loader.js\u0027,\n\u0027tb_loader_script\u0027);\nif(window.performance \u0026\u0026 typeof window.performance.mark \u003d\u003d \u0027function\u0027)\n{window.performance.mark(\u0027tbl_ic\u0027);}\n\u003c/script\u003e\n\n\u003cdiv id\u003d"taboola-below-article-thumbnails" style\u003d"height: 250px; width: 300px;"\u003e\u003c/div\u003e\n\u003cscript type\u003d"text/javascript"\u003e\nwindow._taboola \u003d window._taboola || [];\n_taboola.push({\nmode: \u0027Rbox_300x250_1x1\u0027,\ncontainer: \u0027taboola-below-article-thumbnails\u0027,\nplacement: \u0027wattpad.com_P18694_S257846_W300_H250_N1_TB\u0027,\ntarget_type: \u0027mix\u0027,\n"rtb-win":{ \nbi:\u002749ff4d58ef9a163a696d4fad03621b9e036f24f7_15\u0027,\ncu:\u0027USD\u0027,\nwp:\u0027${AUCTION_PRICE:BF}\u0027,\nwcb:\u0027~!audex-display-impression!~\u0027,\nrt:\u00271643227025284\u0027,\nrdc:\u0027us.taboolasyndication.com\u0027,\nti:\u00274212\u0027,\nex:\u0027MagniteSCoD\u0027,\nbs:\u0027xapi:257846:lvvSm6Ak7_wE\u0027,\nbp:\u002718694\u0027,\nbd:\u0027wattpad.com\u0027,\nsi:\u00279964\u0027\n} \n,\nrec: {"trc":{"si":"a69c7df43b2334f0aa337c37e2d80c21","sd":"v2_a69c7df43b2334f0aa337c37e2d80c21_3c70f7c7d64a65b15e4a4175c9a2cfa51072f04bMagniteSCoD_1643227025_1643227025_CJS1tQEQ5NdWGPLA0d76xo-9ngEgASgEMCY4iegHQIroB0iB09kDUKPPB1gAYABop-G2i_Hl-eVucAA","ui":"3c70f7c7d64a65b15e4a4175c9a2cfa51072f04bMagniteSCoD","plc":"PHON","wi":"-643136642229425433","cc":"CA","route":"US:US:V","el2r":["bulk-metrics","debug","social","metrics","perf"],"uvpw":"1","pi":"1420260","cpb":"GNO629MGIJz__________wEqGXVzLnRhYm9vbGFzeW5kaWNhdGlvbi5jb20yC3RyYy1zY29kMTI5OIDwmrUMQInoB0iK6AdQgdPZA1ijzwdjCN3__________wEQ3f__________ARgjZGMI3AoQoBAYFmRjCNIDEOAGGAhkYwiWFBCcHBgYZGMI9AUQiwoYC2RjCNkUEPkcGB1kYwj0FBCeHRgfZGorNDlmZjRkNThlZjlhMTYzYTY5NmQ0ZmFkMDM2MjFiOWUwMzZmMjRmN18xNXgCgAHpbIgBrPvTxQE","dcga":{"pubConfigOverride":{"border-color":"black","font-weight":"bold","inherit-title-color":"true","module-name":"cta-lazy-module","enable-call-to-action-creative-component":"true","disable-cta-on-custom-module":"true"}},"tslt":{"p-video-overlay":{"cancel":"סגור","goto":"עבור לדף"},"read-more":{"DEFAULT_CAPTION":"%D7%A7%D7%A8%D7%90%20%D7%A2%D7%95%D7%93"},"next-up":{"BTN_TEXT":"לקריאת התוכן הבא"},"time-ago":{"now":"עכשיו","today":"היום","yesterday":"אתמול","minutes":"לפני {0} דקות","hour":"לפני שעה","hours":"לפני {0} שעות","days":"לפני {0} ימים"},"explore-more":{"TITLE_TEXT":"המשיכו לקרוא","POPUP_TEXT":"אל תפספסו הזדמנות לקרוא עוד תוכן מעולה, רגע לפני שתעזבו"}},"evh":"-1964913910","vl":[{"ri":"185db6d274ce94b27caaabd9eed7915b","uip":"wattpad.com_P18694_S257846_W300_H250_N1_TB","ppb":"COIF","estimation_method":"EcpmEstimationMethodType_ESTIMATION","baseline_variant":"false","original_ecpm":"0.4750949889421463","v":[{"thumbnail":"https://cdn.taboola.com/libtrc/static/thumbnails/a2b272be514ca3ebe3f97a4a32a41db5.jpg","all-thumbnails":"https://cdn.taboola.com/libtrc/static/thumbnails/a2b272be514ca3ebe3f97a4a32a41db5.jpg!-#@1600x1000","origin":"default","thumb-size":"1600x1000","title":"Get Roofing Services At Prices You Can Afford In Edmonton","type":"text","published-date":"1641997069","branding-text":"Roofing Services | Search Ads","url":"https://inneth-conded.xyz/9ad2e613-8777-4fe7-9a52-386c88879289?site\u003dwattpad-placement-255\u0026site_id\u003d1420260\u0026title\u003dGet+Roofing+Services+At+Prices+You+Can+Afford+In+Edmonton\u0026platform\u003dSmartphone\u0026campaign_id\u003d15573949\u0026campaign_item_id\u003d3108610633\u0026thumbnail\u003dhttp%3A%2F%2Fcdn.taboola.com%2Flibtrc%2Fstatic%2Fthumbnails%2Fa2b272be514ca3ebe3f97a4a32a41db5.jpg\u0026cpc\u003d{cpc}\u0026click_id\u003dGiCIypnAQogsMTFL3e_mPaVM2qLvK3KRU6LWzEMUgeB6piCit1Uox6CNr5v5n-x1\u0026tblci\u003dGiCIypnAQogsMTFL3e_mPaVM2qLvK3KRU6LWzEMUgeB6piCit1Uox6CNr5v5n-x1#tblciGiCIypnAQogsMTFL3e_mPaVM2qLvK3KRU6LWzEMUgeB6piCit1Uox6CNr5v5n-x1","duration":"0","sig":"328243c4127ff16e3fdcd7270bab908f6f3fc5b4c98d","item-id":"~~V1~~2785119550041083381~~PnBkfBE9JnQxpahv0adkcuIcmMhroRAHXwLZd-7zhunTxvAnL2wqac4MyzR7uD46gj3kUkbS3FhelBtnsiJV6MhkDZRZzzIqDobN6rWmCPA3hYz5D3PLat6nhIftiT1lwdxwdlxkeV_Mfb3eos_TQavImGhxk0e7psNAZxHJ9RKL2w3lppALGgQJoy2o6lkf-pOqODtX1VkgWpEEM4WsVoWOnUTAwdyGd-8yrze8CWNp752y28hl7lleicyO1vByRdbgwlJdnqyroTPEQNNEn1JRxBOSYSWt-Xm3vkPm-G4","uploader":"","is-syndicated":"true","publisher":"search","id":"~~V1~~2785119550041083381~~PnBkfBE9JnQxpahv0adkcuIcmMhroRAHXwLZd-7zhunTxvAnL2wqac4MyzR7uD46gj3kUkbS3FhelBtnsiJV6MhkDZRZzzIqDobN6rWmCPA3hYz5D3PLat6nhIftiT1lwdxwdlxkeV_Mfb3eos_TQavImGhxk0e7psNAZxHJ9RKL2w3lppALGgQJoy2o6lkf-pOqODtX1VkgWpEEM4WsVoWOnUTAwdyGd-8yrze8CWNp752y28hl7lleicyO1vByRdbgwlJdnqyroTPEQNNEn1JRxBOSYSWt-Xm3vkPm-G4","category":"home","views":"0","itp":[{"u":"https://trc.taboola.com/1326786/log/3/unip?en\u003dclickersusa","t":"c"}],"description":""}]}],"cpcud":{"upc":"0.0","upr":"0.0"}}}\n});\n\u003c/script\u003e\n\n\u003cscript type\u003d"text/javascript"\u003e\nwindow._taboola \u003d window._taboola || [];\n_taboola.push({flush: true});\n\u003c/script\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e',
|
|
306
|
+
'adomain': [
|
|
307
|
+
'example.xyz'
|
|
308
|
+
],
|
|
309
|
+
'cid': '15744349',
|
|
310
|
+
'crid': '278195503434041083381',
|
|
311
|
+
'w': 300,
|
|
312
|
+
'h': 250,
|
|
313
|
+
'lurl': 'http://us-trc.taboola.com/sample'
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
'seat': '14204545260'
|
|
317
|
+
}
|
|
318
|
+
],
|
|
319
|
+
'bidid': 'da43860a-4644-442a-b5e0-93f268cf8d19',
|
|
320
|
+
'cur': 'USD'
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
const request = {
|
|
325
|
+
bids: [
|
|
326
|
+
{
|
|
327
|
+
...commonBidRequest,
|
|
328
|
+
...displayBidRequestParams
|
|
329
|
+
}
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
it('should return empty array if no valid bids', function () {
|
|
334
|
+
const res = spec.interpretResponse(serverResponse, [])
|
|
335
|
+
expect(res).to.be.an('array').that.is.empty
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
it('should return empty array if no server response', function () {
|
|
339
|
+
const res = spec.interpretResponse({}, request)
|
|
340
|
+
expect(res).to.be.an('array').that.is.empty
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
it('should return empty array if server response without seatbid', function () {
|
|
344
|
+
const overriddenServerResponse = {...serverResponse};
|
|
345
|
+
const seatbid = {...serverResponse.body.seatbid[0]};
|
|
346
|
+
overriddenServerResponse.body.seatbid[0] = {};
|
|
347
|
+
|
|
348
|
+
const res = spec.interpretResponse(overriddenServerResponse, request)
|
|
349
|
+
expect(res).to.be.an('array').that.is.empty
|
|
350
|
+
|
|
351
|
+
overriddenServerResponse.body.seatbid[0] = seatbid;
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
it('should return empty array if server response without bids', function () {
|
|
355
|
+
const overriddenServerResponse = {...serverResponse};
|
|
356
|
+
const bid = [...serverResponse.body.seatbid[0].bid];
|
|
357
|
+
overriddenServerResponse.body.seatbid[0].bid = {};
|
|
358
|
+
|
|
359
|
+
const res = spec.interpretResponse(overriddenServerResponse, request)
|
|
360
|
+
expect(res).to.be.an('array').that.is.empty
|
|
361
|
+
|
|
362
|
+
overriddenServerResponse.body.seatbid[0].bid = bid;
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
it('should interpret display response', function () {
|
|
366
|
+
const [bid] = serverResponse.body.seatbid[0].bid;
|
|
367
|
+
const expectedRes = [
|
|
368
|
+
{
|
|
369
|
+
requestId: request.bids[0].bidId,
|
|
370
|
+
cpm: bid.price,
|
|
371
|
+
creativeId: bid.crid,
|
|
372
|
+
ttl: 360,
|
|
373
|
+
netRevenue: false,
|
|
374
|
+
currency: serverResponse.body.cur,
|
|
375
|
+
mediaType: 'banner',
|
|
376
|
+
ad: bid.adm,
|
|
377
|
+
width: bid.w,
|
|
378
|
+
height: bid.h,
|
|
379
|
+
meta: {
|
|
380
|
+
'advertiserDomains': bid.adomain
|
|
381
|
+
},
|
|
382
|
+
}
|
|
383
|
+
]
|
|
384
|
+
|
|
385
|
+
const res = spec.interpretResponse(serverResponse, request)
|
|
386
|
+
expect(res).to.deep.equal(expectedRes)
|
|
387
|
+
});
|
|
388
|
+
})
|
|
389
|
+
|
|
390
|
+
describe('userData', function () {
|
|
391
|
+
// todo: add UT for getUserSyncs
|
|
392
|
+
})
|
|
393
|
+
|
|
394
|
+
describe('internal functions', function () {
|
|
395
|
+
describe('getPageUrl', function () {
|
|
396
|
+
let origPageUrl;
|
|
397
|
+
const bidderRequest = {
|
|
398
|
+
refererInfo: {
|
|
399
|
+
canonicalUrl: 'http://canonical.url'
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
beforeEach(function () {
|
|
404
|
+
// remember original pageUrl in config
|
|
405
|
+
origPageUrl = config.getConfig('pageUrl');
|
|
406
|
+
|
|
407
|
+
// unset pageUrl in config
|
|
408
|
+
config.setConfig({pageUrl: null});
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
afterEach(function () {
|
|
412
|
+
// set original pageUrl to config
|
|
413
|
+
config.setConfig({pageUrl: origPageUrl});
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it('should handle empty or missing data', function () {
|
|
417
|
+
expect(internal.getPageUrl(undefined)).to.equal(utils.getWindowTop().location.href);
|
|
418
|
+
expect(internal.getPageUrl('')).to.equal(utils.getWindowTop().location.href);
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it('should use "pageUrl" from config', function () {
|
|
422
|
+
config.setConfig({pageUrl: 'http://page.url'});
|
|
423
|
+
|
|
424
|
+
expect(internal.getPageUrl(undefined)).to.equal(config.getConfig('pageUrl'));
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
it('should use bidderRequest.refererInfo.canonicalUrl', function () {
|
|
428
|
+
expect(internal.getPageUrl(bidderRequest.refererInfo)).to.equal(bidderRequest.refererInfo.canonicalUrl);
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
it('should prefer bidderRequest.refererInfo.canonicalUrl over "pageUrl" from config', () => {
|
|
432
|
+
config.setConfig({pageUrl: 'https://page.url'});
|
|
433
|
+
|
|
434
|
+
expect(internal.getPageUrl(bidderRequest.refererInfo)).to.equal(bidderRequest.refererInfo.canonicalUrl);
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
describe('getReferrer', function () {
|
|
439
|
+
it('should handle empty or missing data', function () {
|
|
440
|
+
expect(internal.getReferrer(undefined)).to.equal(utils.getWindowTop().document.referrer);
|
|
441
|
+
expect(internal.getReferrer('')).to.equal(utils.getWindowTop().document.referrer);
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
it('should use bidderRequest.refererInfo.referer', () => {
|
|
445
|
+
const bidderRequest = {
|
|
446
|
+
refererInfo: {
|
|
447
|
+
referer: 'foobar'
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
expect(internal.getReferrer(bidderRequest.refererInfo)).to.equal(bidderRequest.refererInfo.referer);
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
})
|
|
455
|
+
})
|
|
@@ -1821,7 +1821,7 @@ describe('User ID', function () {
|
|
|
1821
1821
|
}, {adUnits});
|
|
1822
1822
|
});
|
|
1823
1823
|
|
|
1824
|
-
it('test hook from merkleId cookies', function (done) {
|
|
1824
|
+
it('test hook from merkleId cookies - legacy', function (done) {
|
|
1825
1825
|
// simulate existing browser local storage values
|
|
1826
1826
|
coreStorage.setCookie('merkleId', JSON.stringify({'pam_id': {'id': 'testmerkleId', 'keyID': 1}}), (new Date(Date.now() + 5000).toUTCString()));
|
|
1827
1827
|
|
|
@@ -1845,6 +1845,32 @@ describe('User ID', function () {
|
|
|
1845
1845
|
}, {adUnits});
|
|
1846
1846
|
});
|
|
1847
1847
|
|
|
1848
|
+
it('test hook from merkleId cookies', function (done) {
|
|
1849
|
+
// simulate existing browser local storage values
|
|
1850
|
+
coreStorage.setCookie('merkleId', JSON.stringify({
|
|
1851
|
+
'merkleId': [{id: 'testmerkleId', ext: { keyID: 1, ssp: 'ssp1' }}, {id: 'another-random-id-value', ext: { ssp: 'ssp2' }}],
|
|
1852
|
+
'_svsid': 'svs-id-1'
|
|
1853
|
+
}), (new Date(Date.now() + 5000).toUTCString()));
|
|
1854
|
+
|
|
1855
|
+
init(config);
|
|
1856
|
+
setSubmoduleRegistry([merkleIdSubmodule]);
|
|
1857
|
+
config.setConfig(getConfigMock(['merkleId', 'merkleId', 'cookie']));
|
|
1858
|
+
|
|
1859
|
+
requestBidsHook(function () {
|
|
1860
|
+
adUnits.forEach(unit => {
|
|
1861
|
+
unit.bids.forEach(bid => {
|
|
1862
|
+
expect(bid).to.have.deep.nested.property('userId.merkleId');
|
|
1863
|
+
expect(bid.userId.merkleId.length).to.equal(2);
|
|
1864
|
+
expect(bid.userIdAsEids.length).to.equal(2);
|
|
1865
|
+
expect(bid.userIdAsEids[0]).to.deep.equal({ source: 'ssp1.merkleinc.com', uids: [{id: 'testmerkleId', atype: 3, ext: { keyID: 1, ssp: 'ssp1' }}] });
|
|
1866
|
+
expect(bid.userIdAsEids[1]).to.deep.equal({ source: 'ssp2.merkleinc.com', uids: [{id: 'another-random-id-value', atype: 3, ext: { ssp: 'ssp2' }}] });
|
|
1867
|
+
});
|
|
1868
|
+
});
|
|
1869
|
+
coreStorage.setCookie('merkleId', '', EXPIRED_COOKIE_DATE);
|
|
1870
|
+
done();
|
|
1871
|
+
}, {adUnits});
|
|
1872
|
+
});
|
|
1873
|
+
|
|
1848
1874
|
it('test hook from zeotapIdPlus cookies', function (done) {
|
|
1849
1875
|
// simulate existing browser local storage values
|
|
1850
1876
|
coreStorage.setCookie('IDP', btoa(JSON.stringify('abcdefghijk')), (new Date(Date.now() + 5000).toUTCString()));
|
|
@@ -322,7 +322,9 @@ describe('VidazooBidAdapter', function () {
|
|
|
322
322
|
describe('unique deal id', function () {
|
|
323
323
|
const key = 'myKey';
|
|
324
324
|
let uniqueDealId;
|
|
325
|
-
|
|
325
|
+
beforeEach(() => {
|
|
326
|
+
uniqueDealId = getUniqueDealId(key, 0);
|
|
327
|
+
})
|
|
326
328
|
|
|
327
329
|
it('should get current unique deal id', function (done) {
|
|
328
330
|
// waiting some time so `now` will become past
|
|
@@ -333,9 +335,12 @@ describe('VidazooBidAdapter', function () {
|
|
|
333
335
|
}, 200);
|
|
334
336
|
});
|
|
335
337
|
|
|
336
|
-
it('should get new unique deal id on expiration', function () {
|
|
337
|
-
|
|
338
|
-
|
|
338
|
+
it('should get new unique deal id on expiration', function (done) {
|
|
339
|
+
setTimeout(() => {
|
|
340
|
+
const current = getUniqueDealId(key, 100);
|
|
341
|
+
expect(current).to.not.be.equal(uniqueDealId);
|
|
342
|
+
done();
|
|
343
|
+
}, 200)
|
|
339
344
|
});
|
|
340
345
|
});
|
|
341
346
|
|
|
@@ -270,16 +270,18 @@ describe('Zeta Ssp Bid Adapter', function () {
|
|
|
270
270
|
it('Test required params in banner request', function () {
|
|
271
271
|
const request = spec.buildRequests(bannerRequest, bannerRequest[0]);
|
|
272
272
|
const payload = JSON.parse(request.data);
|
|
273
|
+
expect(request.url).to.eql('https://ssp.disqus.com/bid?shortname=test_shortname');
|
|
273
274
|
expect(payload.ext.sid).to.eql('publisherId');
|
|
274
275
|
expect(payload.ext.tags.someTag).to.eql(444);
|
|
275
|
-
expect(payload.ext.tags.shortname).to.
|
|
276
|
+
expect(payload.ext.tags.shortname).to.be.undefined;
|
|
276
277
|
});
|
|
277
278
|
|
|
278
279
|
it('Test required params in video request', function () {
|
|
279
280
|
const request = spec.buildRequests(videoRequest, videoRequest[0]);
|
|
280
281
|
const payload = JSON.parse(request.data);
|
|
282
|
+
expect(request.url).to.eql('https://ssp.disqus.com/bid?shortname=test_shortname');
|
|
281
283
|
expect(payload.ext.sid).to.eql('publisherId');
|
|
282
284
|
expect(payload.ext.tags.someTag).to.eql(444);
|
|
283
|
-
expect(payload.ext.tags.shortname).to.
|
|
285
|
+
expect(payload.ext.tags.shortname).to.be.undefined;
|
|
284
286
|
});
|
|
285
287
|
});
|
package/test/test_deps.js
CHANGED