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

Connatix Bid Adapter : update PlayerId, CustomerId and Referrer #10604

Merged
merged 3 commits into from
Oct 27, 2023
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
7 changes: 3 additions & 4 deletions modules/connatixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,12 @@ export const spec = {
interpretResponse: (serverResponse) => {
const responseBody = serverResponse.body;
const bids = responseBody.Bids;
const playerId = responseBody.PlayerId;
const customerId = responseBody.CustomerId;

if (!isArray(bids) || !playerId || !customerId) {
if (!isArray(bids)) {
return [];
}

const referrer = responseBody.Referrer;
return bids.map(bidResponse => ({
requestId: bidResponse.RequestId,
cpm: bidResponse.Cpm,
Expand All @@ -134,8 +133,8 @@ export const spec = {
width: bidResponse.Width,
height: bidResponse.Height,
creativeId: bidResponse.CreativeId,
referrer: bidResponse.Referrer,
ad: bidResponse.Ad,
referrer: referrer,
}));
},

Expand Down
19 changes: 18 additions & 1 deletion modules/connatixBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,24 @@ Maintainer: prebid_integration@connatix.com

# Description
Connects to Connatix demand source to fetch bids.
Please use ```connatix``` as the bidder code.
Please use ```connatix``` as the bidder code.

# Configuration
Connatix requires that ```iframe``` is used for user syncing.

Example configuration:
```
pbjs.setConfig({
userSync: {
filterSettings: {
iframe: {
bidders: '*', // represents all bidders
filter: 'include'
}
}
}
});
```

# Test Parameters
```
Expand Down
20 changes: 2 additions & 18 deletions test/spec/modules/connatixBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,12 @@ describe('connatixBidAdapter', function () {
describe('interpretResponse', function () {
const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
const Bid = {Cpm: 0.1, RequestId: '2f897340c4eaa3', Ttl: 86400, CustomerId, PlayerId};

let serverResponse;
this.beforeEach(function () {
serverResponse = {
body: {
CustomerId,
PlayerId,
Bids: [ Bid ]
},
headers: function() { }
Expand All @@ -162,18 +160,6 @@ describe('connatixBidAdapter', function () {
expect(response).to.be.an('array').that.is.empty;
});

it('Should return an empty array if CustomerId is null', function () {
serverResponse.body.CustomerId = null;
const response = spec.interpretResponse(serverResponse);
expect(response).to.be.an('array').that.is.empty;
});

it('Should return an empty array if PlayerId is null', function () {
serverResponse.body.PlayerId = null;
const response = spec.interpretResponse(serverResponse);
expect(response).to.be.an('array').that.is.empty;
});

it('Should return one bid response for one bid', function() {
const bidResponses = spec.interpretResponse(serverResponse);
expect(bidResponses.length).to.equal(1);
Expand Down Expand Up @@ -212,12 +198,10 @@ describe('connatixBidAdapter', function () {
const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
const UserSyncEndpoint = 'https://connatix.com/sync'
const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
const Bid = {Cpm: 0.1, RequestId: '2f897340c4eaa3', Ttl: 86400, CustomerId, PlayerId};

const serverResponse = {
body: {
CustomerId,
PlayerId,
UserSyncEndpoint,
Bids: [ Bid ]
},
Expand Down