From 79bb1486433e4d7b7a7275b7b887cde205f28093 Mon Sep 17 00:00:00 2001 From: naegelin <1544569+naegelin@users.noreply.github.com> Date: Wed, 17 Oct 2018 11:53:56 +0200 Subject: [PATCH 1/5] Ensure transaction ID is always unique Transaction ID implicitly suggests that this is a unique identifier per transaction. However in the case of a refresh / re-use of an ad unit the transaction ID remains the same causing undesirable bidding with certain SSPs. --- src/prebid.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/prebid.js b/src/prebid.js index 48d08719cb1..4e2a672afeb 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -348,9 +348,8 @@ $$PREBID_GLOBAL$$.requestBids = createHook('asyncSeries', function ({ bidsBackHa return !includes(s2sBidders, bidder); }) : allBidders; - if (!adUnit.transactionId) { - adUnit.transactionId = utils.generateUUID(); - } + adUnit.transactionId = utils.generateUUID(); + bidders.forEach(bidder => { const adapter = bidderRegistry[bidder]; From b3a7e49c0beb96799c0acdaedbed17ac6106faa6 Mon Sep 17 00:00:00 2001 From: naegelin <1544569+naegelin@users.noreply.github.com> Date: Wed, 17 Oct 2018 12:10:30 +0200 Subject: [PATCH 2/5] Update prebid.js --- src/prebid.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/prebid.js b/src/prebid.js index 4e2a672afeb..a6fbcb85acc 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -347,10 +347,9 @@ $$PREBID_GLOBAL$$.requestBids = createHook('asyncSeries', function ({ bidsBackHa const bidders = (s2sBidders) ? allBidders.filter(bidder => { return !includes(s2sBidders, bidder); }) : allBidders; - + adUnit.transactionId = utils.generateUUID(); - - + bidders.forEach(bidder => { const adapter = bidderRegistry[bidder]; const spec = adapter && adapter.getSpec && adapter.getSpec(); From fdb859779f9d5e990994354f04482583539c4c6f Mon Sep 17 00:00:00 2001 From: naegelin <1544569+naegelin@users.noreply.github.com> Date: Wed, 17 Oct 2018 12:13:37 +0200 Subject: [PATCH 3/5] Update prebid.js --- src/prebid.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/prebid.js b/src/prebid.js index a6fbcb85acc..01a7e03dfc2 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -347,9 +347,9 @@ $$PREBID_GLOBAL$$.requestBids = createHook('asyncSeries', function ({ bidsBackHa const bidders = (s2sBidders) ? allBidders.filter(bidder => { return !includes(s2sBidders, bidder); }) : allBidders; - + adUnit.transactionId = utils.generateUUID(); - + bidders.forEach(bidder => { const adapter = bidderRegistry[bidder]; const spec = adapter && adapter.getSpec && adapter.getSpec(); From aad8a454cf98108727e58749b7ea8d8a97439ead Mon Sep 17 00:00:00 2001 From: Chris Naegelin Date: Fri, 19 Oct 2018 16:41:04 +0200 Subject: [PATCH 4/5] cleanup --- src/prebid.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/prebid.js b/src/prebid.js index 01a7e03dfc2..61c5421c0d3 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -347,9 +347,9 @@ $$PREBID_GLOBAL$$.requestBids = createHook('asyncSeries', function ({ bidsBackHa const bidders = (s2sBidders) ? allBidders.filter(bidder => { return !includes(s2sBidders, bidder); }) : allBidders; - + adUnit.transactionId = utils.generateUUID(); - + bidders.forEach(bidder => { const adapter = bidderRegistry[bidder]; const spec = adapter && adapter.getSpec && adapter.getSpec(); From 8d80ad9ae6de26e9e01a5aac9ec14909e74782ea Mon Sep 17 00:00:00 2001 From: Rich Snapp Date: Fri, 2 Nov 2018 16:13:40 -0600 Subject: [PATCH 5/5] update test for transactionId to always expect newly generated ids --- test/spec/unit/pbjs_api_spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/spec/unit/pbjs_api_spec.js b/test/spec/unit/pbjs_api_spec.js index 1a791f8dd51..5aea27e2cc1 100644 --- a/test/spec/unit/pbjs_api_spec.js +++ b/test/spec/unit/pbjs_api_spec.js @@ -1248,7 +1248,7 @@ describe('Unit: Prebid Module', function () { assert.ok(logMessageSpy.calledWith('No adUnits configured. No bids requested.'), 'expected message was logged'); }); - it('should attach transactionIds to ads (or pass through transactionId if it already exists)', function () { + it('should always attach new transactionIds to adUnits passed to requestBids', function () { $$PREBID_GLOBAL$$.requestBids({ adUnits: [ { @@ -1263,7 +1263,8 @@ describe('Unit: Prebid Module', function () { }); expect(auctionArgs.adUnits[0]).to.have.property('transactionId') - .and.to.equal('d0676a3c-ff32-45a5-af65-8175a8e7ddca'); + .and.to.match(/[a-f0-9\-]{36}/i) + .and.not.to.equal('d0676a3c-ff32-45a5-af65-8175a8e7ddca'); expect(auctionArgs.adUnits[1]).to.have.property('transactionId') .and.to.match(/[a-f0-9\-]{36}/i); });