Skip to content
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
125 changes: 125 additions & 0 deletions dev-docs/bidders/edgequeryxBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import { Renderer } from '../src/Renderer.js';
import * as utils from '../src/utils.js';
import { config } from '../src/config.js';
import { registerBidder, getIabSubCategory } from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO, ADPOD } from '../src/mediaTypes.js';



const BIDDER_CODE = 'edgequeryx';
export const spec = {
code: BIDDER_CODE,
aliases: ['eqx'], // short code
supportedMediaTypes: [BANNER, VIDEO],
/**
* Determines whether or not the given bid request is valid.
*
* @param {BidRequest} bid The bid params to validate.
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: function (bid) {
return !!(bid.params && bid.params.accountId && bid.params.widgetId);
},


/**
* Make a server request from the list of BidRequests.
*
* @param {BidRequest[]} validBidRequests an array of bids
* @param {BidderRequest} bidderRequest bidder request object
* @return {ServerRequest[]} Info describing the request to the server.
*/
buildRequests: function (validBidRequests, bidderRequest) {
// use bidderRequest.bids[] to get bidder-dependent request info
// if your bidder supports multiple currencies, use config.getConfig(currency)
// to find which one the ad server needs

// pull requested transaction ID from bidderRequest.bids[].transactionId
return validBidRequests.map(bid => {
// Common bid request attributes for banner, outstream and instream.
let payload = {
accountId: bid.params.accountId,
widgetId: bid.params.widgetId,
currencyCode: "EUR",
appName: bid.params.appName && bid.params.appName !== '' ? bid.params.appName : undefined,
tagId: bid.adUnitCode,
pageDomain: bidderRequest && bidderRequest.refererInfo && bidderRequest.refererInfo.referer ? bidderRequest.refererInfo.referer : undefined,
transactionId: bid.transactionId,
timeout: config.getConfig('bidderTimeout'),
bidId: bid.bidId,
prebidVersion: '$prebid.version$'
};

const bannerMediaType = utils.deepAccess(bid, 'mediaTypes.banner');
payload.sizes = bannerMediaType.sizes.map(size => ({
w: size[0],
h: size[1]
}));

if (bidderRequest && bidderRequest.gdprConsent) {
payload.gdpr_consent = bidderRequest.gdprConsent.consentString;
payload.gdpr = bidderRequest.gdprConsent.gdprApplies;
}

if (bidderRequest && bidderRequest.uspConsent) {
payload.us_privacy = bidderRequest.uspConsent;
}

var payloadString = JSON.stringify(payload);

return {
method: 'POST',
url: (bid.params.domain !== undefined ? bid.params.domain : 'https://deep.edgequery.io') + '/prebid/x',
data: payloadString,
};
});
},

/**
* Unpack the response from the server into a list of bids.
*
* @param {*} serverResponse A successful response from the server.
* @param {*} bidRequestString
* @return {Bid[]} An array of bids which were nested inside the server.
*/
interpretResponse: function (serverResponse, bidRequestString) {
const bidResponses = [];
let response = serverResponse.body;
try {
if (response) {
const bidRequest = JSON.parse(bidRequestString.data);

let bidResponse = {
requestId: response.requestId,
cpm: response.cpm,
currency: response.currency,
width: response.width,
height: response.height,
ad: response.ad,
ttl: response.ttl,
creativeId: response.creativeId,
netRevenue: response.netRevenue
};

bidResponses.push(bidResponse);
}
} catch (error) {
utils.logError('Error while parsing Edge Query X response', error);
}
return bidResponses;
},


getUserSyncs: function (syncOptions, serverResponses) {
const syncs = [];
if (syncOptions.iframeEnabled && serverResponses.length > 0) {
syncs.push({
type: 'iframe',
url: serverResponses[0].body.cSyncUrl
});
}
return syncs;
}
};

registerBidder(spec);
39 changes: 39 additions & 0 deletions dev-docs/bidders/edgequeryxBidAdapter.mb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Overview

```
Module Name: Edge, Query X Bidder Adapter
Module Type: Bidder Adapter
Maintainer: contact@edgequery.com
```

# Description

Connect to Edge Query X for bids.

The Edge Query X adapter requires setup and approval from the Edge Query team.
Please reach out to your Technical account manager for more information.

# Test Parameters

## Web
```
var adUnits = [
{
code: 'test-div',
mediaTypes: {
banner: {
sizes: [[1, 1]]
}
},
bids: [
{
bidder: "edgequeryx",
params: {
accountId: "test",
widgetId: "test"
}
}
]
}
];
```