Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for badv/bcat and user sync via Identity Link #778

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions modules/sharethroughBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { registerBidder } from '../src/adapters/bidderFactory.js';
import * as utils from '../src/utils.js';

const VERSION = '3.2.1';
const VERSION = '3.3.0';
const BIDDER_CODE = 'sharethrough';
const STR_ENDPOINT = 'https://btlr.sharethrough.com/WYu2BXv1/v1';
const DEFAULT_SIZE = [1, 1];
Expand Down Expand Up @@ -56,6 +56,10 @@ export const sharethroughAdapterSpec = {
query.pubcid = bidRequest.crumbs.pubcid;
}

if (bidRequest.userId && bidRequest.userId.idl_env) {
query.idluid = bidRequest.userId.idl_env;
}

if (bidRequest.schain) {
query.schain = JSON.stringify(bidRequest.schain);
}
Expand All @@ -64,6 +68,14 @@ export const sharethroughAdapterSpec = {
query.bidfloor = parseFloat(bidRequest.bidfloor);
}

if (bidRequest.params.badv) {
query.badv = bidRequest.params.badv;
}

if (bidRequest.params.bcat) {
query.bcat = bidRequest.params.bcat;
}

// Data that does not need to go to the server,
// but we need as part of interpretResponse()
const strData = {
Expand All @@ -73,7 +85,7 @@ export const sharethroughAdapterSpec = {
};

return {
method: 'GET',
method: 'POST',
url: STR_ENDPOINT,
data: query,
strData: strData
Expand Down
8 changes: 7 additions & 1 deletion modules/sharethroughBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ Module that connects to Sharethrough's demand sources
// OPTIONAL - If iframeSize is provided, we'll use this size for the iframe
// otherwise we'll grab the largest size from the sizes array
// This is ignored if iframe: false
iframeSize: [250, 250]
iframeSize: [250, 250],

// OPTIONAL - Blocked Advertiser Domains
badv: ['domain1.com', 'domain2.com'],

// OPTIONAL - Blocked Categories (IAB codes)
bcat: ['IAB1-1', 'IAB1-2'],
}
}
]
Expand Down
54 changes: 46 additions & 8 deletions test/spec/modules/sharethroughBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const bidRequests = [
},
userId: {
tdid: 'fake-tdid',
pubcid: 'fake-pubcid'
pubcid: 'fake-pubcid',
idl_env: 'fake-identity-link'
},
crumbs: {
pubcid: 'fake-pubcid-in-crumbs-obj'
Expand All @@ -40,12 +41,32 @@ const bidRequests = [
iframe: true,
iframeSize: [500, 500]
}
}
},
{
bidder: 'sharethrough',
bidId: 'bidId4',
sizes: [[700, 400]],
placementCode: 'bar',
params: {
pkey: 'dddd4444',
badv: ['domain1.com', 'domain2.com']
}
},
{
bidder: 'sharethrough',
bidId: 'bidId5',
sizes: [[700, 400]],
placementCode: 'bar',
params: {
pkey: 'eeee5555',
bcat: ['IAB1-1', 'IAB1-2']
}
},
];

const prebidRequests = [
{
method: 'GET',
method: 'POST',
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
data: {
bidId: 'bidId',
Expand All @@ -57,7 +78,7 @@ const prebidRequests = [
}
},
{
method: 'GET',
method: 'POST',
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
data: {
bidId: 'bidId',
Expand All @@ -69,7 +90,7 @@ const prebidRequests = [
}
},
{
method: 'GET',
method: 'POST',
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
data: {
bidId: 'bidId',
Expand All @@ -82,7 +103,7 @@ const prebidRequests = [
}
},
{
method: 'GET',
method: 'POST',
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
data: {
bidId: 'bidId',
Expand All @@ -94,7 +115,7 @@ const prebidRequests = [
}
},
{
method: 'GET',
method: 'POST',
url: 'https://btlr.sharethrough.com/WYu2BXv1/v1',
data: {
bidId: 'bidId',
Expand Down Expand Up @@ -225,7 +246,7 @@ describe('sharethrough adapter spec', function() {

expect(builtBidRequests[0].url).to.eq('https://btlr.sharethrough.com/WYu2BXv1/v1');
expect(builtBidRequests[1].url).to.eq('https://btlr.sharethrough.com/WYu2BXv1/v1');
expect(builtBidRequests[0].method).to.eq('GET');
expect(builtBidRequests[0].method).to.eq('POST');
});

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

it('should add the idluid parameter if a bid request contains a value for Identity Link from Live Ramp', function() {
const bidRequest = spec.buildRequests(bidRequests)[0];
expect(bidRequest.data.idluid).to.eq('fake-identity-link');
});

it('should add Sharethrough specific parameters', function() {
const builtBidRequests = spec.buildRequests(bidRequests);
expect(builtBidRequests[0]).to.deep.include({
Expand Down Expand Up @@ -346,6 +372,18 @@ describe('sharethrough adapter spec', function() {
expect(builtBidRequest.data.schain).to.eq(JSON.stringify(bidRequest.schain));
});

it('should add badv if provided', () => {
const builtBidRequest = spec.buildRequests([bidRequests[3]])[0];

expect(builtBidRequest.data.badv).to.have.members(['domain1.com', 'domain2.com'])
});

it('should add bcat if provided', () => {
const builtBidRequest = spec.buildRequests([bidRequests[4]])[0];

expect(builtBidRequest.data.bcat).to.have.members(['IAB1-1', 'IAB1-2'])
});

it('should not add a supply chain parameter if schain is missing', function() {
const bidRequest = spec.buildRequests(bidRequests)[0];
expect(bidRequest.data).to.not.include.any.keys('schain');
Expand Down