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 TapSense Header Bidding Adapter and tests #1004

Merged
merged 3 commits into from
Mar 8, 2017
Merged

Add TapSense Header Bidding Adapter and tests #1004

merged 3 commits into from
Mar 8, 2017

Conversation

erikchau
Copy link
Contributor

Type of change

  • New bidder adapter

Description of change

Addition of the TapSense Header Bidding Adapter

  • test parameters for validating bids
{
  bidder: 'tapsense',
  params: {
    ufid: "ZFiAg3MMs6E4KVyIDVbi8165506790392",
    refer: "localhost",
    jsonp: 1,
    ad_unit_id: "5877f75b0118065391b18f8c",
    device_id: "7bd153d3-8e9f-4bae-a4b3-751614d788b5",
    lat: "47.5643",
    long: "-122.151",
    scriptURL: "https://ads04.tapsense.com/ads/mopubad",
    user: "771fc655-6e4e-4bae-a4b6-751614d788b5",
    price_floor: 0.04,
    test: 1
  }
}
  • contact email of the adapter’s maintainer
    amit@tapsense.com
  • official adapter submission

Other information

@mkendall07 mkendall07 self-assigned this Mar 1, 2017
@erikchau
Copy link
Contributor Author

erikchau commented Mar 3, 2017

Hi @mkendall07, we currently have a publisher waiting to integrate with us, anyway we can help to speed up the merge process?

tagging @amitmanjhi

@@ -0,0 +1,89 @@
//v0.0.1
var bidfactory = require('../bidfactory.js');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use const/let instead of var as appropriate.

if (!bid.params.scriptURL) {
continue;
}
var queryString = "?price=true&callback=tapsense.callback_with_price_" + bid.bidId + "&version=" + version + "&";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer string templates here instead of concatenation.

continue;
}
var queryString = "?price=true&callback=tapsense.callback_with_price_" + bid.bidId + "&version=" + version + "&";
window.tapsense["callback_with_price_" + bid.bidId] = generateCallback(bid.bidId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the the prebid global object $$PREBID_GLOBAL$$ instead of window.

if (validParams.indexOf(keys[j]) < 0) continue;
queryString += encodeURIComponent(keys[j]) + "=" + encodeURIComponent(bid.params[keys[j]]) + "&";
}
var scriptURL = bid.params.scriptURL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make scriptUrl static or is it required to be passed in?

}

function generateCallback(bidId){
return function(response, price) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this is an anonymous function?

return;
}
for (var k = 0; k < bid.sizes.length; k++) {
if (creativeSizes.indexOf(bid.sizes[k].join("x")) > -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails if the bid.sizes is a single array and not a nested array (ie [300,250]; instead of [[300,250]];)

@mkendall07
Copy link
Member

@erikchau
Can you also mention which params are required and which are optional? Thanks

* changed var to es6 let/const
* when checking for bid sizes, use utils.parseSizesInput to handle single/nested arrays
* use template strings where applicable
* use $$PREBID_GLOBAL$$ instead of window
* scriptUrl is now static
* named anonymous function in generateCallBack
* add more tests in tapsense_spec.js
@erikchau
Copy link
Contributor Author

erikchau commented Mar 7, 2017

Name Scope Description Example
ad_unit_id required Placement ID from TapSense “ 5877f75b0118065391b18f8c”
user required User's IDFA "771fc655-6e4e-4bae-a4b6-751614d788b5"
refer optional Site that ad request originated from “https://tapsense.com”
lat optional Users latitude “ 47.5643”
long optional Users longitude “-122.151”
price_floor optional Minimum Bid in dollars “ 0.04”

@erikchau
Copy link
Contributor Author

erikchau commented Mar 7, 2017

@mkendall07 ready for re-review
let me know if there is anything else
thanks!

const TapSenseAdapter = function TapSenseAdapter() {
const version = "0.0.1";
const creativeSizes = [
"320x50"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only valid bid size?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For header bidding we only currently only support banner requests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, probably want to make a note about this in your bidder documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, to create our bidder documentation I will need to make a PR for this page with our information correct?? http://prebid.org/dev-docs/bidders.html

@mkendall07
Copy link
Member

Thanks for the updates. With the changes, I'm getting
pbjs.tapsense.callback_with_price_26c264cf22f421({"id": "58becf1bda78506f6409a5fb","status": {"value": "error"},"count_ad_units": 0}, 1.2)
Response with specified bid params.

@erikchau
Copy link
Contributor Author

erikchau commented Mar 7, 2017

Sorry, should have mentioned that the ad unit id I supplied was for android devices. You will need to set your UA as any android device. Our servers check that the user agent matches the ad unit's platform.
screen shot 2017-03-07 at 10 48 21 am

@erikchau
Copy link
Contributor Author

erikchau commented Mar 8, 2017

Created bidder documentation PR here: prebid/prebid.github.io#186
Is there anything else left to be done on my end @mkendall07 ?
thanks

@mkendall07
Copy link
Member

LGTM. Thanks

@mkendall07 mkendall07 merged commit c8b77a3 into prebid:master Mar 8, 2017
@erikchau erikchau deleted the tapsense_adapter branch March 8, 2017 20:42
outoftime pushed a commit to Genius/Prebid.js that referenced this pull request Mar 20, 2017
* Add TapSense Header Bidding Adapter and tests

* Update for Tapsense Prebid Header

* changed var to es6 let/const
* when checking for bid sizes, use utils.parseSizesInput to handle single/nested arrays
* use template strings where applicable
* use $$PREBID_GLOBAL$$ instead of window
* scriptUrl is now static
* named anonymous function in generateCallBack
* add more tests in tapsense_spec.js

* Url Callback parameter needed prebid global object
outoftime pushed a commit to Genius/Prebid.js that referenced this pull request Mar 20, 2017
…built

* 'master' of https://github.com/prebid/Prebid.js:
  Add GourmetAds AppNexus Alias (prebid#1057)
  fix issue calling `requestBids();` (prebid#1058)
  explicit win url response format as pixel (prebid#1001)
  OpenX Adapter: Correctly gets the page domain for cross-domain iframes (prebid#1027)
  better http/s support (prebid#1010)
  Add a new generated field transactionId to each adunits. (prebid#1040)
  Update readme (prebid#1053)
  PulsePoint Lite adapter (prebid#1016)
  Add new adapter ServerBid (by Adzerk) (prebid#1024)
  Fix Mantis tests in negative timezone (prebid#1049)
  Add deal id handling (prebid#1044)
  sanitize bidderRequest to rubicon adapter to ensure accountId is sent (prebid#1030)
  Bidfluence Adapter (prebid#1023)
  Update uglify-js version (prebid#1041)
  Add dev dependencies.
  hb_adid should be uppercase in all cases (prebid#1037)
  Add TapSense Header Bidding Adapter and tests (prebid#1004)
  iOS Referrer fix (prebid#996)
  Change identification of JavaScript user matching (prebid#1022)
  Fixed mixed tabs/spaces in wideorbit adapter (prebid#1031)
@mkendall07
Copy link
Member

@erikchau
This is merged into master. Please submit a PR to the docs repo to add a file for your adapter to the bidders directory so your adapter's params will appear on the bidders page. Thank you for contributing

@erikchau
Copy link
Contributor Author

erikchau commented Mar 23, 2017

hi @mkendall07 , this has already been done and merged to master
#1004

@mkendall07
Copy link
Member

oh, great. You were fast :) thanks

dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* Add TapSense Header Bidding Adapter and tests

* Update for Tapsense Prebid Header

* changed var to es6 let/const
* when checking for bid sizes, use utils.parseSizesInput to handle single/nested arrays
* use template strings where applicable
* use $$PREBID_GLOBAL$$ instead of window
* scriptUrl is now static
* named anonymous function in generateCallBack
* add more tests in tapsense_spec.js

* Url Callback parameter needed prebid global object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants