Skip to content

Commit

Permalink
new TapHype bidder adapter (prebid#3319)
Browse files Browse the repository at this point in the history
* new TapHype bidder adapter

* Added 930x600 to Rubicon Adapter (prebid#3323)

* PubMatic adapter to support TTD (prebid#3311)

* first commit

* added unit test cases for TTD id

* Sonobi - support video and display same adunit (prebid#3325)

* changed adapter to support video and display for ad unit

* added case for sbi_ct outstream

* outstream is display media type

* Fix user-sync iframes insertion bug (prebid#3300)

According to documentation, iframes should be inserted at bottom
of head, rather than at top.

* Prevent 33Across adapter from throwing an error when unable to getElementById(), fix JSDocs in utils.js (prebid#3333)

* check gdpr in buildRequest

* User sync based on whether gdpr applies or not

* check if consent data exists during user sync

* split user sync into further branches: 1) when gdpr does not apply 2) when consent data is unavailable

* contribute viewability to ttxRequest

* update tests

* remove window mock from tests

* use local variables

* introduce ServerRequestBuilder

* add withOptions() method to ServerRequestBuilder

* add semicolons

* sync up package-lock.json with upstream/master

* stub window.top in tests

* introduce getTopWindowSize() for test purpose

* reformat code

* add withSite() method to TtxRequestBuilder

add withSite() method to TtxRequestBuilder

* add isIframe() and _isViewabilityMeasurable()

* handle NON_MEASURABLE viewability in nested iframes

* consider page visibility, stub utils functions getWindowTop() and getWindowSelf()

* contribute viewability as 0 for inactive tab

* add prebidjs version to ttx request

* send caller as an array

* fix JSDoc in utils.js

* send viewability as non measurable when unable to locate target HTMLElement, add warning message

* TripleliftBidAdapter-update creative_id (prebid#3324)

* removed dependancy on getTopWindowUrl for referer

* protect against undefined obj and remove test on old dependency

* added unit test for referer and gdpr in query string

* removed gdpr test

* removed gdpr from bidderRequest obj

* decontructed bidder request obj in chai test

* just need to run karma tests again

* added gdpr consent to all bidderRequest obj in chai tests

* changed creativeId to be a Triplelift specific id rather than represent SRA impression

* error-proofed creative id

* Update taphypeBidAdapter.js

removed `supportedMediaTypes` and logging

* Update taphypeBidAdapter.js

remove mediaTypes import

* new TapHype bidder adapter

* Update taphypeBidAdapter.js

removed `supportedMediaTypes` and logging

* Update taphypeBidAdapter.js

remove mediaTypes import
  • Loading branch information
aeliox authored and Pedro López Jiménez committed Mar 18, 2019
1 parent 8d7e43f commit 2779585
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 0 deletions.
45 changes: 45 additions & 0 deletions modules/taphypeBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {registerBidder} from 'src/adapters/bidderFactory';

export const spec = {
code: 'taphype',
isBidRequestValid: function (bid) {
return !!bid.params.placementId;
},
buildRequests: function (bidRequests) {
const requests = bidRequests.map(function (bid) {
const params = {
placementId: bid.params.placementId,
url: encodeURIComponent(window.location.href),
size: bid.sizes[0][0] + 'x' + bid.sizes[0][1],
rnd: Math.random(),
bidId: bid.bidId,
};

return {method: 'GET', url: 'https://us-central1-taphype-internal.cloudfunctions.net/th-prebid', data: params, options: {withCredentials: false}}
});

return requests;
},
interpretResponse: function (serverResponse, bidRequest) {
if (!serverResponse || !serverResponse.body || !serverResponse.body.ad) {
return [];
}

const bid = serverResponse.body;
const sizes = bid.size.split(',');

return [{
requestId: bidRequest.data.bidId,
cpm: bid.price,
width: sizes[0],
height: sizes[1],
creativeId: bidRequest.data.bidId,
currency: bid.currency || 'USD',
netRevenue: true,
ad: bid.ad,
ttl: 360
}];
},
};

registerBidder(spec);
32 changes: 32 additions & 0 deletions modules/taphypeBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Overview

Module Name: TapHype Bidder Adapter
Module Type: Bidder Adapter
Maintainer: admin@taphype.com

# Description

You can use this adapter to get a bid from taphype.com.


# Test Parameters
```javascript
var adUnits = [
{
code: 'div-taphype-example',
sizes: [[300, 250]],
bids: [
{
bidder: "taphype",
params: {
placementId: 12345
}
}
]
}
];
```

Where:

* placementId - TapHype Placement ID
56 changes: 56 additions & 0 deletions test/spec/modules/taphypeBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { expect } from 'chai';
import { spec } from 'modules/taphypeBidAdapter';

describe('taphypeBidAdapterTests', function () {
it('validate_pub_params', function () {
expect(spec.isBidRequestValid({
bidder: 'taphype',
params: {
placementId: 12345
}
})).to.equal(true);
});

it('validate_generated_params', function () {
let bidRequestData = [{
bidId: 'bid12345',
bidder: 'taphype',
params: {
placementId: 12345
},
sizes: [[300, 250]]
}];

let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;

expect(req_data.bidId).to.equal('bid12345');
});

it('validate_response_params', function () {
let bidRequestData = {
data: {
bidId: 'bid12345'
}
};

let serverResponse = {
body: {
price: 1.23,
ad: '<html></html>',
size: '300,250'
}
};

let bids = spec.interpretResponse(serverResponse, bidRequestData);
expect(bids).to.have.lengthOf(1);
let bid = bids[0];
expect(bid.cpm).to.equal(1.23);
expect(bid.currency).to.equal('USD');
expect(bid.width).to.equal('300');
expect(bid.height).to.equal('250');
expect(bid.netRevenue).to.equal(true);
expect(bid.requestId).to.equal('bid12345');
expect(bid.ad).to.equal('<html></html>');
});
});

0 comments on commit 2779585

Please sign in to comment.