Skip to content

Commit

Permalink
updated frontpage demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Heray committed Nov 24, 2015
1 parent 6cec5dd commit cbf5a76
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 106 deletions.
97 changes: 0 additions & 97 deletions _includes/example_code.html

This file was deleted.

5 changes: 0 additions & 5 deletions _layouts/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ <h4>Other examples:</h4>
</tr>
</table>

<!-- {% highlight js linenos %}
{% include example_code.html %}
{% endhighlight %} -->

</div>

Expand Down
34 changes: 34 additions & 0 deletions assets/js/pbjs-draw-log-diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,39 @@ function createBar(eventData, isBid) {
return [eventName, startTime, duration, tooltip, style, annotation];
}

function logToParse(logs) {
for (eventCode in logs) {

if (eventCode == 'bids') {
var bidEvents = logs[eventCode];
for (var i in bidEvents) {
var bidEvent = bidEvents[i];

var latency = bidEvent['end'] - bidEvent['start'];
var cpm = bidEvent['cpm'];
var bidderCode = bidEvent['bidderCode'];

var CPMobj = Parse.Object.extend("demoCPM");
var cpmObj = new CPMobj();
cpmObj.set("bidderCode", bidderCode);
cpmObj.set("cpm", cpm);
cpmObj.set("loadTime", latency);

cpmObj.save(null, {
success: function(visitor) {
console.log('added to parse')
},
error: function(visitor, error) {
// Show the error message somewhere and let the user try again.
console.log('failed at adding to parse');
}
});

}
}
}
}


// logs = {"Load Prebid.js":{"static":true,"start":0,"end":4},"Adserver Timer":{"static":true,"start":0,"end":619},"amazon":{"start":134,"end":618,"cpm":0},"appnexus":{"start":132,"end":519,"cpm":0.5},"criteo":{"start":152,"end":519,"cpm":0},"openx":{"start":153,"end":1349},"pubmatic":{"start":135,"end":1059},"rubicon":{"start":154,"end":734,"cpm":3.813333},"Load GPT":{"static":true,"start":619,"end":813},"Set Targeting":{"static":true,"start":816,"end":842}};
//finalEndTime = 1500;
Expand Down Expand Up @@ -115,4 +148,5 @@ window.drawLog = function(logs, finalEndTime) {
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(dataTable, options);

logToParse(logs);
}
2 changes: 2 additions & 0 deletions assets/js/pbjs-event-logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ eventLogger.logBidsLatency = function() {
bidEvent['end'] = bid.responseTimestamp - initTime;
bidEvent['cpm'] = bid.cpm;

bidEvent['bidderCode'] = bid.bidderCode;

pbjsLog.bids.push(bidEvent);
}
});
Expand Down
Binary file modified dev-docs/.DS_Store
Binary file not shown.
50 changes: 46 additions & 4 deletions examples/pbjs_demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@
{
bidder: 'appnexus',
params: {
placementId: '4799418',
"referrer":"rolando.com",
"alt_referrer":"rolando.com"
placementId: '4799418'
}
},
},/*
// 1 ad unit can also be targeted by multiple bids from 1 bidder
{
bidder: 'appnexus',
Expand Down Expand Up @@ -132,6 +130,50 @@
adSlot: 'TO ADD'
}
}*/
{
bidder: 'pubmatic',
params: {
publisherId: 39741,
adSlot: '39620189@300x250'
}
}, /*{
bidder: 'pubmatic',
params: {
publisherId: 39741,
adSlot: '39620189@300x600'
}
},*/
{
bidder: 'criteo',
params: {
nid: "2612",
cookiename: "cto_test"
}
},{
bidder: 'rubicon',
params: {
rp_account : '9707',
rp_site: '17955',
rp_zonesize : '50983-15',
rp_tracking : 'affiliate-1701207318',
rp_floor : '0.1'
}
},{
bidder: 'casale',
params: {
slotId: '1',
casaleUrl: 'http://js.indexww.com/ht/elitedaily.js'
}
},
{
bidder: 'openx',
params: {
unit: '537986875',
pageURL : 'http://elitedaily.com',
refererURL : 'http://elitedaily.com',
jstag_url : 'http://ox-d.elitedaily.servedbyopenx.com/w/1.0/jstag?nc=5765-elite_daily'
}
}
]
}];

Expand Down

0 comments on commit cbf5a76

Please sign in to comment.