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

Impactify Bid Adapter: add userid schain support #7377

Merged
Merged
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
17 changes: 15 additions & 2 deletions modules/impactifyBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { registerBidder } from '../src/adapters/bidderFactory.js';
import * as utils from '../src/utils.js';
import { config } from '../src/config.js';
import {ajax} from '../src/ajax.js';
import { createEidsArray } from './userId/eids.js';

const BIDDER_CODE = 'impactify';
const BIDDER_ALIAS = ['imp'];
Expand Down Expand Up @@ -32,14 +33,26 @@ const createOpenRtbRequest = (validBidRequests, bidderRequest) => {
id: bidderRequest.auctionId,
validBidRequests,
cur: [DEFAULT_CURRENCY],
imp: []
imp: [],
source: {tid: bidderRequest.auctionId}
};

// Force impactify debugging parameter
if (window.localStorage.getItem('_im_db_bidder') != null) {
request.test = Number(window.localStorage.getItem('_im_db_bidder'));
}

// Set Schain in request
let schain = utils.deepAccess(validBidRequests, '0.schain');
if (schain) request.source.ext = { schain: schain };

// Set eids
let bidUserId = utils.deepAccess(validBidRequests, '0.userId');
let eids = createEidsArray(bidUserId);
if (eids.length) {
utils.deepSetValue(request, 'user.ext.eids', eids);
}

// Set device/user/site
if (!request.device) request.device = {};
if (!request.site) request.site = {};
Expand Down Expand Up @@ -106,7 +119,7 @@ const createOpenRtbRequest = (validBidRequests, bidderRequest) => {
export const spec = {
code: BIDDER_CODE,
gvlid: GVLID,
supportedMediaTypes: ['video'],
supportedMediaTypes: ['video', 'banner'],
aliases: BIDDER_ALIAS,

/**
Expand Down
16 changes: 15 additions & 1 deletion test/spec/modules/impactifyBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,21 @@ describe('ImpactifyAdapter', function () {
bidId: '123456789',
bidderRequestId: '987654321',
auctionId: '19ab94a9-b0d7-4ed7-9f80-ad0c033cf1b1',
transactionId: 'f7b2c372-7a7b-11eb-9439-0242ac130002'
transactionId: 'f7b2c372-7a7b-11eb-9439-0242ac130002',
userId: {
pubcid: '87a0327b-851c-4bb3-a925-0c7be94548f5'
},
userIdAsEids: [
{
source: 'pubcid.org',
uids: [
{
id: '87a0327b-851c-4bb3-a925-0c7be94548f5',
atype: 1
}
]
}
]
}
];
let videoBidderRequest = {
Expand Down