Skip to content

Commit 9f38423

Browse files
maphemadma
andauthored
[Sharethrough] Add Support for badv/bcat and Identity Link User ID (#6100)
* Add support for badv and bcat [#175358412] Co-authored-by: Michael Duran <[email protected]> * Add support for Identity Link [#175688307] Co-authored-by: Michael Duran <[email protected]> Co-authored-by: Michael Duran <[email protected]>
1 parent 0a5f9db commit 9f38423

File tree

3 files changed

+67
-11
lines changed

3 files changed

+67
-11
lines changed

modules/sharethroughBidAdapter.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { registerBidder } from '../src/adapters/bidderFactory.js';
22
import * as utils from '../src/utils.js';
33

4-
const VERSION = '3.2.1';
4+
const VERSION = '3.3.0';
55
const BIDDER_CODE = 'sharethrough';
66
const STR_ENDPOINT = 'https://btlr.sharethrough.com/WYu2BXv1/v1';
77
const DEFAULT_SIZE = [1, 1];
@@ -56,6 +56,10 @@ export const sharethroughAdapterSpec = {
5656
query.pubcid = bidRequest.crumbs.pubcid;
5757
}
5858

59+
if (bidRequest.userId && bidRequest.userId.idl_env) {
60+
query.idluid = bidRequest.userId.idl_env;
61+
}
62+
5963
if (bidRequest.schain) {
6064
query.schain = JSON.stringify(bidRequest.schain);
6165
}
@@ -64,6 +68,14 @@ export const sharethroughAdapterSpec = {
6468
query.bidfloor = parseFloat(bidRequest.bidfloor);
6569
}
6670

71+
if (bidRequest.params.badv) {
72+
query.badv = bidRequest.params.badv;
73+
}
74+
75+
if (bidRequest.params.bcat) {
76+
query.bcat = bidRequest.params.bcat;
77+
}
78+
6779
// Data that does not need to go to the server,
6880
// but we need as part of interpretResponse()
6981
const strData = {
@@ -73,7 +85,7 @@ export const sharethroughAdapterSpec = {
7385
};
7486

7587
return {
76-
method: 'GET',
88+
method: 'POST',
7789
url: STR_ENDPOINT,
7890
data: query,
7991
strData: strData

modules/sharethroughBidAdapter.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ Module that connects to Sharethrough's demand sources
2929
// OPTIONAL - If iframeSize is provided, we'll use this size for the iframe
3030
// otherwise we'll grab the largest size from the sizes array
3131
// This is ignored if iframe: false
32-
iframeSize: [250, 250]
32+
iframeSize: [250, 250],
33+
34+
// OPTIONAL - Blocked Advertiser Domains
35+
badv: ['domain1.com', 'domain2.com'],
36+
37+
// OPTIONAL - Blocked Categories (IAB codes)
38+
bcat: ['IAB1-1', 'IAB1-2'],
3339
}
3440
}
3541
]

test/spec/modules/sharethroughBidAdapter_spec.js

+46-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const bidRequests = [
1414
},
1515
userId: {
1616
tdid: 'fake-tdid',
17-
pubcid: 'fake-pubcid'
17+
pubcid: 'fake-pubcid',
18+
idl_env: 'fake-identity-link'
1819
},
1920
crumbs: {
2021
pubcid: 'fake-pubcid-in-crumbs-obj'
@@ -40,12 +41,32 @@ const bidRequests = [
4041
iframe: true,
4142
iframeSize: [500, 500]
4243
}
43-
}
44+
},
45+
{
46+
bidder: 'sharethrough',
47+
bidId: 'bidId4',
48+
sizes: [[700, 400]],
49+
placementCode: 'bar',
50+
params: {
51+
pkey: 'dddd4444',
52+
badv: ['domain1.com', 'domain2.com']
53+
}
54+
},
55+
{
56+
bidder: 'sharethrough',
57+
bidId: 'bidId5',
58+
sizes: [[700, 400]],
59+
placementCode: 'bar',
60+
params: {
61+
pkey: 'eeee5555',
62+
bcat: ['IAB1-1', 'IAB1-2']
63+
}
64+
},
4465
];
4566

4667
const prebidRequests = [
4768
{
48-
method: 'GET',
69+
method: 'POST',
4970
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
5071
data: {
5172
bidId: 'bidId',
@@ -57,7 +78,7 @@ const prebidRequests = [
5778
}
5879
},
5980
{
60-
method: 'GET',
81+
method: 'POST',
6182
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
6283
data: {
6384
bidId: 'bidId',
@@ -69,7 +90,7 @@ const prebidRequests = [
6990
}
7091
},
7192
{
72-
method: 'GET',
93+
method: 'POST',
7394
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
7495
data: {
7596
bidId: 'bidId',
@@ -82,7 +103,7 @@ const prebidRequests = [
82103
}
83104
},
84105
{
85-
method: 'GET',
106+
method: 'POST',
86107
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
87108
data: {
88109
bidId: 'bidId',
@@ -94,7 +115,7 @@ const prebidRequests = [
94115
}
95116
},
96117
{
97-
method: 'GET',
118+
method: 'POST',
98119
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
99120
data: {
100121
bidId: 'bidId',
@@ -225,7 +246,7 @@ describe('sharethrough adapter spec', function() {
225246

226247
expect(builtBidRequests[0].url).to.eq('https://btlr.sharethrough.com/WYu2BXv1/v1');
227248
expect(builtBidRequests[1].url).to.eq('https://btlr.sharethrough.com/WYu2BXv1/v1');
228-
expect(builtBidRequests[0].method).to.eq('GET');
249+
expect(builtBidRequests[0].method).to.eq('POST');
229250
});
230251

231252
it('should set the instant_play_capable parameter correctly based on browser userAgent string', function() {
@@ -315,6 +336,11 @@ describe('sharethrough adapter spec', function() {
315336
expect(bidRequest.data.pubcid).to.eq('fake-pubcid');
316337
});
317338

339+
it('should add the idluid parameter if a bid request contains a value for Identity Link from Live Ramp', function() {
340+
const bidRequest = spec.buildRequests(bidRequests)[0];
341+
expect(bidRequest.data.idluid).to.eq('fake-identity-link');
342+
});
343+
318344
it('should add Sharethrough specific parameters', function() {
319345
const builtBidRequests = spec.buildRequests(bidRequests);
320346
expect(builtBidRequests[0]).to.deep.include({
@@ -346,6 +372,18 @@ describe('sharethrough adapter spec', function() {
346372
expect(builtBidRequest.data.schain).to.eq(JSON.stringify(bidRequest.schain));
347373
});
348374

375+
it('should add badv if provided', () => {
376+
const builtBidRequest = spec.buildRequests([bidRequests[3]])[0];
377+
378+
expect(builtBidRequest.data.badv).to.have.members(['domain1.com', 'domain2.com'])
379+
});
380+
381+
it('should add bcat if provided', () => {
382+
const builtBidRequest = spec.buildRequests([bidRequests[4]])[0];
383+
384+
expect(builtBidRequest.data.bcat).to.have.members(['IAB1-1', 'IAB1-2'])
385+
});
386+
349387
it('should not add a supply chain parameter if schain is missing', function() {
350388
const bidRequest = spec.buildRequests(bidRequests)[0];
351389
expect(bidRequest.data).to.not.include.any.keys('schain');

0 commit comments

Comments
 (0)