prebid.js 8.7.0 → 8.8.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/33acrossIdSystem.js +1 -1
- package/dist/a1MediaRtdProvider.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/admaticBidAdapter.js +1 -1
- package/dist/adqueryBidAdapter.js +1 -1
- package/dist/adqueryIdSystem.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidViewability.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/brandmetricsRtdProvider.js +1 -1
- package/dist/bridBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantAnalyticsAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/cwireBidAdapter.js +1 -1
- package/dist/dependencies.json +4 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/euidIdSystem.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/geoedgeRtdProvider.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsRtdProvider.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hypelabBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/imdsBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.js +1 -1
- package/dist/kulturemediaBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveIntentIdSystem.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/magniteAnalyticsAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/minutemediaplusBidAdapter.js +1 -1
- package/dist/nativoBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +138 -137
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/operaadsBidAdapter.js +1 -1
- package/dist/operaadsIdSystem.js +1 -0
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/oxxionAnalyticsAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/retailspotBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smartyadsBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/snigelBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/topicsFpdModule.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/uid2IdSystem.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.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/integrationExamples/topics/topics-server.js +72 -0
- package/modules/.submodules.json +2 -1
- package/modules/a1MediaRtdProvider.js +1 -1
- package/modules/admaticBidAdapter.js +5 -0
- package/modules/adqueryBidAdapter.js +23 -21
- package/modules/adqueryIdSystem.js +45 -30
- package/modules/adrelevantisBidAdapter.js +2 -0
- package/modules/bidViewability.js +7 -0
- package/modules/bidViewability.md +9 -8
- package/modules/brandmetricsRtdProvider.js +30 -27
- package/modules/criteoBidAdapter.js +66 -43
- package/modules/geoedgeRtdProvider.js +43 -13
- package/modules/geoedgeRtdProvider.md +2 -1
- package/modules/liveIntentIdSystem.js +16 -1
- package/modules/nativoBidAdapter.js +21 -3
- package/modules/onetagBidAdapter.js +3 -0
- package/modules/operaadsBidAdapter.js +5 -0
- package/modules/operaadsBidAdapter.md +5 -5
- package/modules/operaadsIdSystem.js +106 -0
- package/modules/operaadsIdSystem.md +52 -0
- package/modules/oxxionAnalyticsAdapter.js +22 -5
- package/modules/rubiconBidAdapter.js +2 -2
- package/modules/smartyadsBidAdapter.js +18 -1
- package/modules/snigelBidAdapter.js +69 -16
- package/modules/snigelBidAdapter.md +9 -3
- package/modules/topicsFpdModule.js +35 -9
- package/modules/visxBidAdapter.js +51 -1
- package/package.json +2 -2
- package/src/adloader.js +1 -0
- package/src/native.js +2 -2
- package/test/spec/modules/admaticBidAdapter_spec.js +5 -0
- package/test/spec/modules/adqueryIdSystem_spec.js +13 -24
- package/test/spec/modules/bidViewability_spec.js +32 -1
- package/test/spec/modules/brandmetricsRtdProvider_spec.js +6 -0
- package/test/spec/modules/criteoBidAdapter_spec.js +228 -0
- package/test/spec/modules/eids_spec.js +48 -0
- package/test/spec/modules/geoedgeRtdProvider_spec.js +44 -24
- package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +5 -0
- package/test/spec/modules/liveIntentIdSystem_spec.js +5 -0
- package/test/spec/modules/nativoBidAdapter_spec.js +6 -1
- package/test/spec/modules/onetagBidAdapter_spec.js +69 -0
- package/test/spec/modules/operaadsIdSystem_spec.js +53 -0
- package/test/spec/modules/oxxionAnalyticsAdapter_spec.js +6 -1
- package/test/spec/modules/rubiconBidAdapter_spec.js +24 -0
- package/test/spec/modules/smartyadsBidAdapter_spec.js +49 -0
- package/test/spec/modules/snigelBidAdapter_spec.js +57 -6
- package/test/spec/modules/topicsFpdModule_spec.js +102 -1
- package/test/spec/modules/visxBidAdapter_spec.js +151 -1
- package/test/spec/native_spec.js +5 -3
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
reset,
|
|
9
9
|
topicStorageName
|
|
10
10
|
} from '../../../modules/topicsFpdModule.js';
|
|
11
|
+
import {config} from 'src/config.js';
|
|
11
12
|
import {deepClone, safeJSONParse} from '../../../src/utils.js';
|
|
12
13
|
import {getCoreStorageManager} from 'src/storageManager.js';
|
|
13
|
-
import {config} from 'src/config.js';
|
|
14
14
|
import * as activities from '../../../src/activities/rules.js';
|
|
15
15
|
import {ACTIVITY_ENRICH_UFPD} from '../../../src/activities/activities.js';
|
|
16
16
|
|
|
@@ -414,3 +414,104 @@ describe('topics', () => {
|
|
|
414
414
|
});
|
|
415
415
|
});
|
|
416
416
|
});
|
|
417
|
+
|
|
418
|
+
describe('handles fetch request for topics api headers', () => {
|
|
419
|
+
let stubbedFetch;
|
|
420
|
+
const storage = getCoreStorageManager('topicsFpd');
|
|
421
|
+
|
|
422
|
+
beforeEach(() => {
|
|
423
|
+
stubbedFetch = sinon.stub(window, 'fetch');
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
afterEach(() => {
|
|
427
|
+
stubbedFetch.restore();
|
|
428
|
+
storage.removeDataFromLocalStorage(topicStorageName);
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
it('should make a fetch call when a fetchUrl is present for a selected bidder', () => {
|
|
432
|
+
config.setConfig({
|
|
433
|
+
userSync: {
|
|
434
|
+
topics: {
|
|
435
|
+
maxTopicCaller: 3,
|
|
436
|
+
bidders: [
|
|
437
|
+
{
|
|
438
|
+
bidder: 'pubmatic',
|
|
439
|
+
fetchUrl: 'http://localhost:3000/topics-server.js'
|
|
440
|
+
}
|
|
441
|
+
],
|
|
442
|
+
},
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
stubbedFetch.returns(Promise.resolve(true));
|
|
447
|
+
loadTopicsForBidders({
|
|
448
|
+
browsingTopics: true,
|
|
449
|
+
featurePolicy: {
|
|
450
|
+
allowsFeature() { return true }
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
sinon.assert.calledOnce(stubbedFetch);
|
|
454
|
+
stubbedFetch.calledWith('http://localhost:3000/topics-server.js');
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
it('should not make a fetch call when a fetchUrl is not present for a selected bidder', () => {
|
|
458
|
+
config.setConfig({
|
|
459
|
+
userSync: {
|
|
460
|
+
topics: {
|
|
461
|
+
maxTopicCaller: 3,
|
|
462
|
+
bidders: [
|
|
463
|
+
{
|
|
464
|
+
bidder: 'pubmatic'
|
|
465
|
+
}
|
|
466
|
+
],
|
|
467
|
+
},
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
loadTopicsForBidders({
|
|
472
|
+
browsingTopics: true,
|
|
473
|
+
featurePolicy: {
|
|
474
|
+
allowsFeature() { return true }
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
sinon.assert.notCalled(stubbedFetch);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
it('a fetch request should not be made if the configured fetch rate duration has not yet passed', () => {
|
|
481
|
+
const storedSegments = JSON.stringify(
|
|
482
|
+
[['pubmatic', {
|
|
483
|
+
'2206021246': {
|
|
484
|
+
'ext': {'segtax': 600, 'segclass': '2206021246'},
|
|
485
|
+
'segment': [{'id': '243'}, {'id': '265'}],
|
|
486
|
+
'name': 'ads.pubmatic.com'
|
|
487
|
+
},
|
|
488
|
+
'lastUpdated': new Date().getTime()
|
|
489
|
+
}]]
|
|
490
|
+
);
|
|
491
|
+
|
|
492
|
+
storage.setDataInLocalStorage(topicStorageName, storedSegments);
|
|
493
|
+
|
|
494
|
+
config.setConfig({
|
|
495
|
+
userSync: {
|
|
496
|
+
topics: {
|
|
497
|
+
maxTopicCaller: 3,
|
|
498
|
+
bidders: [
|
|
499
|
+
{
|
|
500
|
+
bidder: 'pubmatic',
|
|
501
|
+
fetchUrl: 'http://localhost:3000/topics-server.js',
|
|
502
|
+
fetchRate: 1 // in days. 1 fetch per day
|
|
503
|
+
}
|
|
504
|
+
],
|
|
505
|
+
},
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
loadTopicsForBidders({
|
|
510
|
+
browsingTopics: true,
|
|
511
|
+
featurePolicy: {
|
|
512
|
+
allowsFeature() { return true }
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
sinon.assert.notCalled(stubbedFetch);
|
|
516
|
+
});
|
|
517
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
|
-
import { spec } from 'modules/visxBidAdapter.js';
|
|
2
|
+
import { spec, storage } from 'modules/visxBidAdapter.js';
|
|
3
3
|
import { config } from 'src/config.js';
|
|
4
4
|
import { newBidder } from 'src/adapters/bidderFactory.js';
|
|
5
5
|
import * as utils from 'src/utils.js';
|
|
@@ -82,6 +82,9 @@ describe('VisxAdapter', function () {
|
|
|
82
82
|
});
|
|
83
83
|
return res;
|
|
84
84
|
}
|
|
85
|
+
|
|
86
|
+
let cookiesAreEnabledStub, localStorageIsEnabledStub;
|
|
87
|
+
|
|
85
88
|
const bidderRequest = {
|
|
86
89
|
timeout: 3000,
|
|
87
90
|
refererInfo: {
|
|
@@ -180,6 +183,24 @@ describe('VisxAdapter', function () {
|
|
|
180
183
|
'ext': {'bidder': {'uid': 903537}}
|
|
181
184
|
}];
|
|
182
185
|
|
|
186
|
+
before(() => {
|
|
187
|
+
$$PREBID_GLOBAL$$.bidderSettings = {
|
|
188
|
+
visx: {
|
|
189
|
+
storageAllowed: false
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
localStorageIsEnabledStub = sinon.stub(storage, 'localStorageIsEnabled');
|
|
193
|
+
cookiesAreEnabledStub = sinon.stub(storage, 'cookiesAreEnabled');
|
|
194
|
+
localStorageIsEnabledStub.returns(false);
|
|
195
|
+
cookiesAreEnabledStub.returns(false);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
after(() => {
|
|
199
|
+
localStorageIsEnabledStub.restore();
|
|
200
|
+
cookiesAreEnabledStub.restore();
|
|
201
|
+
$$PREBID_GLOBAL$$.bidderSettings = {};
|
|
202
|
+
});
|
|
203
|
+
|
|
183
204
|
it('should attach valid params to the tag', function () {
|
|
184
205
|
const firstBid = bidRequests[0];
|
|
185
206
|
const bids = [firstBid];
|
|
@@ -422,6 +443,7 @@ describe('VisxAdapter', function () {
|
|
|
422
443
|
});
|
|
423
444
|
return res;
|
|
424
445
|
}
|
|
446
|
+
let cookiesAreEnabledStub, localStorageIsEnabledStub;
|
|
425
447
|
const bidderRequest = {
|
|
426
448
|
timeout: 3000,
|
|
427
449
|
refererInfo: {
|
|
@@ -449,6 +471,24 @@ describe('VisxAdapter', function () {
|
|
|
449
471
|
}
|
|
450
472
|
];
|
|
451
473
|
|
|
474
|
+
before(() => {
|
|
475
|
+
$$PREBID_GLOBAL$$.bidderSettings = {
|
|
476
|
+
visx: {
|
|
477
|
+
storageAllowed: false
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
localStorageIsEnabledStub = sinon.stub(storage, 'localStorageIsEnabled');
|
|
481
|
+
cookiesAreEnabledStub = sinon.stub(storage, 'cookiesAreEnabled');
|
|
482
|
+
localStorageIsEnabledStub.returns(false);
|
|
483
|
+
cookiesAreEnabledStub.returns(false);
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
after(() => {
|
|
487
|
+
localStorageIsEnabledStub.restore();
|
|
488
|
+
cookiesAreEnabledStub.restore();
|
|
489
|
+
$$PREBID_GLOBAL$$.bidderSettings = {};
|
|
490
|
+
});
|
|
491
|
+
|
|
452
492
|
it('should send requst for banner bid', function () {
|
|
453
493
|
const request = spec.buildRequests([bidRequests[0]], bidderRequest);
|
|
454
494
|
const payload = parseRequest(request.url);
|
|
@@ -486,6 +526,7 @@ describe('VisxAdapter', function () {
|
|
|
486
526
|
});
|
|
487
527
|
return res;
|
|
488
528
|
}
|
|
529
|
+
let cookiesAreEnabledStub, localStorageIsEnabledStub;
|
|
489
530
|
const bidderRequest = {
|
|
490
531
|
timeout: 3000,
|
|
491
532
|
refererInfo: {
|
|
@@ -529,10 +570,23 @@ describe('VisxAdapter', function () {
|
|
|
529
570
|
documentStub.withArgs('visx-adunit-element-2').returns({
|
|
530
571
|
id: 'visx-adunit-element-2'
|
|
531
572
|
});
|
|
573
|
+
|
|
574
|
+
$$PREBID_GLOBAL$$.bidderSettings = {
|
|
575
|
+
visx: {
|
|
576
|
+
storageAllowed: false
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
localStorageIsEnabledStub = sinon.stub(storage, 'localStorageIsEnabled');
|
|
580
|
+
cookiesAreEnabledStub = sinon.stub(storage, 'cookiesAreEnabled');
|
|
581
|
+
localStorageIsEnabledStub.returns(false);
|
|
582
|
+
cookiesAreEnabledStub.returns(false);
|
|
532
583
|
});
|
|
533
584
|
|
|
534
585
|
after(function() {
|
|
535
586
|
sandbox.restore();
|
|
587
|
+
localStorageIsEnabledStub.restore();
|
|
588
|
+
cookiesAreEnabledStub.restore();
|
|
589
|
+
$$PREBID_GLOBAL$$.bidderSettings = {};
|
|
536
590
|
});
|
|
537
591
|
|
|
538
592
|
it('should find ad slot by ad unit code as element id', function () {
|
|
@@ -1323,4 +1377,100 @@ describe('VisxAdapter', function () {
|
|
|
1323
1377
|
expect(query).to.deep.equal({});
|
|
1324
1378
|
});
|
|
1325
1379
|
});
|
|
1380
|
+
|
|
1381
|
+
describe('first party user id', function () {
|
|
1382
|
+
const USER_ID_KEY = '__vads';
|
|
1383
|
+
const USER_ID_DUMMY_VALUE_COOKIE = 'dummy_id_cookie';
|
|
1384
|
+
const USER_ID_DUMMY_VALUE_LOCAL_STORAGE = 'dummy_id_local_storage';
|
|
1385
|
+
|
|
1386
|
+
let getDataFromLocalStorageStub, localStorageIsEnabledStub;
|
|
1387
|
+
let getCookieStub, cookiesAreEnabledStub;
|
|
1388
|
+
|
|
1389
|
+
const bidRequests = [
|
|
1390
|
+
{
|
|
1391
|
+
'bidder': 'visx',
|
|
1392
|
+
'params': {
|
|
1393
|
+
'uid': 903535
|
|
1394
|
+
},
|
|
1395
|
+
'adUnitCode': 'adunit-code-1',
|
|
1396
|
+
'sizes': [[300, 250], [300, 600]],
|
|
1397
|
+
'bidId': '30b31c1838de1e',
|
|
1398
|
+
'bidderRequestId': '22edbae2733bf6',
|
|
1399
|
+
'auctionId': '1d1a030790a475',
|
|
1400
|
+
}
|
|
1401
|
+
];
|
|
1402
|
+
const bidderRequest = {
|
|
1403
|
+
timeout: 3000,
|
|
1404
|
+
refererInfo: {
|
|
1405
|
+
page: 'https://example.com'
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
|
|
1409
|
+
beforeEach(() => {
|
|
1410
|
+
$$PREBID_GLOBAL$$.bidderSettings = {
|
|
1411
|
+
visx: {
|
|
1412
|
+
storageAllowed: true
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
cookiesAreEnabledStub = sinon.stub(storage, 'cookiesAreEnabled');
|
|
1416
|
+
localStorageIsEnabledStub = sinon.stub(storage, 'localStorageIsEnabled');
|
|
1417
|
+
});
|
|
1418
|
+
|
|
1419
|
+
afterEach(() => {
|
|
1420
|
+
cookiesAreEnabledStub.restore();
|
|
1421
|
+
localStorageIsEnabledStub.restore();
|
|
1422
|
+
getCookieStub && getCookieStub.restore();
|
|
1423
|
+
getDataFromLocalStorageStub && getDataFromLocalStorageStub.restore();
|
|
1424
|
+
$$PREBID_GLOBAL$$.bidderSettings = {};
|
|
1425
|
+
});
|
|
1426
|
+
|
|
1427
|
+
it('should not pass user id if both cookies and local storage are not available', function () {
|
|
1428
|
+
cookiesAreEnabledStub.returns(false);
|
|
1429
|
+
localStorageIsEnabledStub.returns(false);
|
|
1430
|
+
|
|
1431
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
1432
|
+
|
|
1433
|
+
expect(request.data.user).to.be.undefined;
|
|
1434
|
+
});
|
|
1435
|
+
|
|
1436
|
+
it('should get user id from cookie if available', function () {
|
|
1437
|
+
cookiesAreEnabledStub.returns(true);
|
|
1438
|
+
localStorageIsEnabledStub.returns(false);
|
|
1439
|
+
getCookieStub = sinon.stub(storage, 'getCookie');
|
|
1440
|
+
getCookieStub.withArgs(USER_ID_KEY).returns(USER_ID_DUMMY_VALUE_COOKIE);
|
|
1441
|
+
|
|
1442
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
1443
|
+
|
|
1444
|
+
expect(request.data.user.ext.vads).to.equal(USER_ID_DUMMY_VALUE_COOKIE);
|
|
1445
|
+
});
|
|
1446
|
+
|
|
1447
|
+
it('should get user id from local storage if available', function () {
|
|
1448
|
+
cookiesAreEnabledStub.returns(false);
|
|
1449
|
+
localStorageIsEnabledStub.returns(true);
|
|
1450
|
+
getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
|
|
1451
|
+
getDataFromLocalStorageStub.withArgs(USER_ID_KEY).returns(USER_ID_DUMMY_VALUE_LOCAL_STORAGE);
|
|
1452
|
+
|
|
1453
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
1454
|
+
|
|
1455
|
+
expect(request.data.user.ext.vads).to.equal(USER_ID_DUMMY_VALUE_LOCAL_STORAGE);
|
|
1456
|
+
});
|
|
1457
|
+
|
|
1458
|
+
it('should create user id and store it in cookies (if user id does not exist)', function () {
|
|
1459
|
+
cookiesAreEnabledStub.returns(true);
|
|
1460
|
+
localStorageIsEnabledStub.returns(false);
|
|
1461
|
+
|
|
1462
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
1463
|
+
expect(storage.getCookie(USER_ID_KEY)).to.be.a('string');
|
|
1464
|
+
expect(request.data.user.ext.vads).to.be.a('string');
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1467
|
+
it('should create user id and store it in local storage (if user id does not exist)', function () {
|
|
1468
|
+
cookiesAreEnabledStub.returns(false);
|
|
1469
|
+
localStorageIsEnabledStub.returns(true);
|
|
1470
|
+
|
|
1471
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
1472
|
+
expect(storage.getDataFromLocalStorage(USER_ID_KEY)).to.be.a('string');
|
|
1473
|
+
expect(request.data.user.ext.vads).to.be.a('string');
|
|
1474
|
+
});
|
|
1475
|
+
});
|
|
1326
1476
|
});
|
package/test/spec/native_spec.js
CHANGED
|
@@ -631,7 +631,8 @@ describe('native.js', function () {
|
|
|
631
631
|
eventtrackers: [
|
|
632
632
|
{ event: 1, method: 1, url: 'https://sampleurl.com' },
|
|
633
633
|
{ event: 1, method: 2, url: 'https://sampleurljs.com' }
|
|
634
|
-
]
|
|
634
|
+
],
|
|
635
|
+
imptrackers: [ 'https://sample-imp.com' ]
|
|
635
636
|
}
|
|
636
637
|
describe('toLegacyResponse', () => {
|
|
637
638
|
it('returns assets in legacy format for ortb responses', () => {
|
|
@@ -640,8 +641,9 @@ describe('native.js', function () {
|
|
|
640
641
|
expect(actual.title).to.equal('vtitle');
|
|
641
642
|
expect(actual.clickUrl).to.equal('url');
|
|
642
643
|
expect(actual.javascriptTrackers).to.equal('<script async src="https://sampleurljs.com"></script>');
|
|
643
|
-
expect(actual.impressionTrackers.length).to.equal(
|
|
644
|
-
expect(actual.impressionTrackers
|
|
644
|
+
expect(actual.impressionTrackers.length).to.equal(2);
|
|
645
|
+
expect(actual.impressionTrackers).to.contain('https://sampleurl.com');
|
|
646
|
+
expect(actual.impressionTrackers).to.contain('https://sample-imp.com');
|
|
645
647
|
});
|
|
646
648
|
});
|
|
647
649
|
});
|