-
-
Save duyet/9629b12703240d740dec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RTBkit = require('../build/x86_64/bin/rtb.node'); | |
var services = require('../build/x86_64/bin/services.node'); | |
var zookeeperUri = "localhost:2181"; //must point to same Zookeeper as routers | |
var services = new services.ServiceProxies(); | |
services.bootstrap('bootstrap.json'); | |
var agent = new RTBkit.BiddingAgent('myAgent', services); | |
var winCostModel = new RTBkit.WinCostModel(); | |
agent.onBidRequest = function(timestamp, auctionId, bidRequest, bids, | |
timeAvailableMs, augmentations) { | |
var bid = 2; | |
var creativeIndex = 0; | |
bids.bid(0, creativeIndex, RTBkit.USD_CPM(bid), 10); | |
var meta = {}; | |
agent.doBid(auctionId, bids, meta, winCostModel); | |
}; | |
agent.onNeedConfig = function() {}; | |
agent.onGotConfig = function() {}; | |
agent.onError = function(err) { | |
console.log(arguments); | |
}; | |
agent.onWin = function() { | |
console.log(arguments); | |
}; | |
agent.init(); | |
agent.start(); | |
agent.doConfig({ | |
"account":[ | |
"a", | |
"very", | |
"long", | |
"account", | |
"name", | |
"thingy" | |
], | |
"augmentations": {}, | |
"bidControl":{ | |
"fixedBidCpmInMicros":0, | |
"type":"RELAY" | |
}, | |
"creatives":[ | |
{ | |
"format":"728x90", | |
"id":2, | |
"name":"LeaderBoard", | |
"tagId":2 | |
}, | |
{ | |
"format":"160x600", | |
"id":0, | |
"name":"LeaderBoard", | |
"tagId":0 | |
}, | |
{ | |
"format":"300x250", | |
"id":1, | |
"name":"BigBox", | |
"tagId":1 | |
} | |
], | |
"errorFormat":"lightweight", | |
"lossFormat":"lightweight", | |
"minTimeAvailableMs":5.0, | |
"tagFilter":{ | |
"excludeIfNotPresent":false | |
}, | |
"test":false, | |
"winFormat":"full" | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment