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

Sda #22

Closed
wants to merge 30 commits into from
Closed

Sda #22

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8acd2b4
Smartadserver Bid Adapter: Add support for SDA user and site
mcourouble Nov 9, 2022
d3387b8
Merge branch 'prebid:master' into master
krzysztofequativ Nov 15, 2022
72c7169
Merge remote-tracking branch 'upstream/master'
mcourouble Nov 16, 2022
24ebad8
Smartadserver Bid Adapter: Fix SDA support getConfig and add to unit …
mcourouble Nov 16, 2022
3952d84
Merge branch 'prebid:master' into master
krzysztofequativ Jan 13, 2023
36312fd
support floors per media type
krzysztofequativ Jan 17, 2023
f7f51b6
Merge pull request #14 from smartadserver/floor-per-mediatype
krzysztofequativ Jan 18, 2023
18c659b
Merge branch 'prebid:master' into master
krzysztofequativ Jan 23, 2023
de0d762
Add GPP support
krzysztofequativ Jan 24, 2023
5b89a6e
Rework payloads enriching
krzysztofequativ Jan 24, 2023
6db82d2
Merge pull request #16 from smartadserver/floor-per-mediatype
krzysztofequativ Jan 25, 2023
f5767f7
Merge branch 'prebid:master' into master
krzysztofequativ Jan 26, 2023
9ef7251
Merge branch 'master' into gpp
krzysztofequativ Feb 1, 2023
d4dcbf9
Merge pull request #15 from smartadserver/gpp
krzysztofequativ Feb 1, 2023
fe96171
Merge branch 'prebid:master' into master
krzysztofequativ Feb 1, 2023
0a12454
Merge branch 'prebid:master' into master
krzysztofequativ Feb 2, 2023
10ee3df
Merge branch 'prebid:master' into master
krzysztofequativ May 19, 2023
7323339
Add gpid support
krzysztofequativ May 22, 2023
ebcb8e5
Merge pull request #17 from smartadserver/gpid
krzysztofequativ May 26, 2023
62a184d
Merge branch 'prebid:master' into master
krzysztofequativ Nov 30, 2023
2795791
Support additional video params
krzysztofequativ Dec 1, 2023
dd0e886
vpmt as array of numbers
krzysztofequativ Dec 6, 2023
000f8e1
Merge pull request #18 from smartadserver/video-params
krzysztofequativ Dec 11, 2023
f7d3573
Merge branch 'prebid:master' into master
krzysztofequativ Dec 11, 2023
9f5d9d2
Fix comment
krzysztofequativ Jan 3, 2024
9f6f72c
Merge branch 'prebid:master' into master
darekodz Feb 26, 2024
a43c345
Merge branch 'prebid:master' into master
krzysztofequativ Mar 6, 2024
9370508
add dsa support
krzysztofequativ Mar 12, 2024
e9e778f
Merge branch 'prebid:master' into sda
krzysztofequativ Apr 8, 2024
b2a5924
add u.t.
krzysztofequativ Apr 9, 2024
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
22 changes: 20 additions & 2 deletions modules/smartadserverBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { deepAccess, deepClone, isArrayOfNums, isFn, isInteger, isPlainObject, logError } from '../src/utils.js';
import {
deepAccess,
deepClone,
isArray,
isArrayOfNums,
isEmpty,
isFn,
isInteger,
isPlainObject,
logError
} from '../src/utils.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { config } from '../src/config.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
Expand Down Expand Up @@ -201,6 +211,11 @@ export const spec = {
payload.gpid = gpid;
}

const dsa = deepAccess(bid, 'ortb2.regs.ext.dsa');
if (dsa) {
payload.dsa = dsa;
}

if (bidderRequest) {
if (bidderRequest.gdprConsent) {
payload.addtl_consent = bidderRequest.gdprConsent.addtlConsent;
Expand Down Expand Up @@ -282,7 +297,10 @@ export const spec = {
netRevenue: response.isNetCpm,
ttl: response.ttl,
dspPixels: response.dspPixels,
meta: { advertiserDomains: response.adomain ? response.adomain : [] }
meta: {
...isArray(response.adomain) && !isEmpty(response.adomain) ? { advertiserDomains: response.adomain } : {},
...!isEmpty(response.dsa) ? { dsa: response.dsa } : {}
}
};

if (bidRequest.mediaType === VIDEO) {
Expand Down
58 changes: 58 additions & 0 deletions test/spec/modules/smartadserverBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,32 @@ describe('Smart bid adapter tests', function () {
expect(syncs).to.have.lengthOf(0);
});

it('Verify metadata', function () {
const adomain = ['advertiser-domain.com'];
const dsa = {
dsarequired: 1,
pubrender: 0,
datatopub: 1,
transparency: [{
domain: 'smartadserver.com',
dsaparams: [1, 2]
}]
};
const request = spec.buildRequests(DEFAULT_PARAMS);
const bids = spec.interpretResponse({
body: {
...BID_RESPONSE.body,
adomain,
dsa,
}
}, request[0]);

expect(bids[0].cpm).to.equal(12);
expect(bids[0]).to.have.property('meta');
expect(bids[0].meta).to.have.property('advertiserDomains').and.to.deep.equal(adomain);
expect(bids[0].meta).to.have.property('dsa').and.to.deep.equal(dsa);
});

describe('gdpr tests', function () {
afterEach(function () {
config.setConfig({ ortb2: undefined });
Expand Down Expand Up @@ -1505,6 +1531,38 @@ describe('Smart bid adapter tests', function () {
});
});

describe('Digital Services Act (DSA)', function () {
it('should include dsa if ortb2.regs.ext.dsa available', function () {
const dsa = {
dsarequired: 1,
pubrender: 0,
datatopub: 1,
transparency: [
{
domain: 'ok.domain.com',
dsaparams: [1, 2]
},
{
domain: 'ko.domain.com',
dsaparams: [1, '3']
}
]
};

const bidRequests = deepClone(DEFAULT_PARAMS_WO_OPTIONAL);
bidRequests[0].ortb2 = {
regs: {
ext: { dsa }
}
};

const request = spec.buildRequests(bidRequests);
const requestContent = JSON.parse(request[0].data);

expect(requestContent).to.have.property('dsa').and.to.deep.equal(dsa);
});
});

describe('#getValuableProperty method', function () {
it('should return an object when calling with a number value', () => {
const obj = spec.getValuableProperty('prop', 3);
Expand Down