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

Add Colombia adapter #2975

Merged
merged 7 commits into from
Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
73 changes: 73 additions & 0 deletions modules/colombiaBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import * as utils from 'src/utils';
import {config} from 'src/config';
import {registerBidder} from 'src/adapters/bidderFactory';

const BIDDER_CODE = 'colombia';
const ENDPOINT_URL = 'https://ade.clmbtech.com/cde/prebid.htm';
const HOST_NAME = document.location.protocol + '//' + window.location.host;

export const spec = {
code: BIDDER_CODE,
aliases: ['clmb'],
isBidRequestValid: function(bid) {
return !!(bid.params.placementId);
},
buildRequests: function(validBidRequests) {
return validBidRequests.map(bidRequest => {
const params = bidRequest.params;
const sizes = utils.parseSizesInput(bidRequest.sizes)[0];
const width = sizes.split('x')[0];
const height = sizes.split('x')[1];
const placementId = params.placementId;
const cb = Math.floor(Math.random() * 99999999999);
const referrer = encodeURIComponent(utils.getTopWindowUrl());
const bidId = bidRequest.bidId;
const payload = {
v: 'hb1',
p: placementId,
w: width,
h: height,
cb: cb,
r: referrer,
uid: bidId,
t: 'i',
d: HOST_NAME,
};
return {
method: 'POST',
url: ENDPOINT_URL,
data: payload,
}
});
},
interpretResponse: function(serverResponse, bidRequest) {
const bidResponses = [];
const response = serverResponse.body;
const crid = response.creativeId || 0;
const width = response.width || 0;
const height = response.height || 0;
const cpm = response.cpm || 0;
if (width !== 0 && height !== 0 && cpm !== 0 && crid !== 0) {
const dealId = response.dealid || '';
const currency = response.currency || 'USD';
const netRevenue = (response.netRevenue === undefined) ? true : response.netRevenue;
const referrer = utils.getTopWindowUrl();
const bidResponse = {
requestId: bidRequest.data.uid,
cpm: cpm,
width: response.width,
height: response.height,
creativeId: crid,
dealId: dealId,
currency: currency,
netRevenue: netRevenue,
ttl: config.getConfig('_bidderTimeout'),
referrer: referrer,
ad: response.ad
};
bidResponses.push(bidResponse);
}
return bidResponses;
}
}
registerBidder(spec);
27 changes: 27 additions & 0 deletions modules/colombiaBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Overview

```
Module Name: COLOMBIA Bidder Adapter
Module Type: Bidder Adapter
Maintainer: colombiaonline@timesinteret.in
```

# Description

Connect to COLOMBIA for bids.

THE COLOMBIA adapter requires setup and approval from the COLOMBIA team. Please reach out to your account team or colombiaonline@timesinteret.in for more information.

# Test Parameters
```
var adUnits = [{
code: 'test-ad-div',
sizes: [[300, 250]],
bids: [{
bidder: 'colombia',
params: {
placementId: '44082'
}
}]
}];
```