Skip to content

Instantly share code, notes, and snippets.

@enactdev
Last active September 11, 2015 19:05
Show Gist options
  • Save enactdev/9a216b4f2d34c2f0b2d9 to your computer and use it in GitHub Desktop.
Save enactdev/9a216b4f2d34c2f0b2d9 to your computer and use it in GitHub Desktop.
Most popular trackers on news websites
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.chart rect {
fill: steelblue;
}
.chart text {
fill: white;
font: 10px sans-serif;
text-anchor: end;
}
</style>
<svg class="chart"></svg>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script>
var width = 420,
barHeight = 20;
var x = d3.scale.linear()
.range([0, width]);
var chart = d3.select(".chart")
.attr("width", width);
d3.csv("trackers.csv", type, function(error, data) {
x.domain([0, d3.max(data, function(d) { return d.website_count; })]);
chart.attr("height", barHeight * data.length);
var bar = chart.selectAll("g")
.data(data)
.enter().append("g")
.attr("transform", function(d, i) { return "translate(0," + i * barHeight + ")"; });
bar.append("rect")
.attr("width", function(d) { return x(d.website_count); })
.attr("height", barHeight - 1);
bar.append("text")
.attr("x", function(d) { return x(d.website_count) - 3; })
.attr("y", barHeight / 2)
.attr("dy", ".35em")
.text(function(d) { return d.tracker; });
});
function type(d) {
d.website_count = +d.website_count; // coerce to number
return d;
}
</script>
tracker website_count
DoubleClick 25
Google Adsense 25
ScoreCard Research Beacon 25
Moat 23
BlueKai 22
AppNexus 21
NetRatings SiteCensus 19
Facebook Connect 19
Rubicon 18
Quantcast 18
Google Analytics 16
ChartBeat 16
Neustar AdAdvisor 15
OpenX 15
Turn Inc. 14
Criteo 14
Media Optimizer (Adobe) 14
Facebook Custom Audience 14
PubMatic 14
Advertising.com 14
Aggregate Knowledge 14
MediaMath 14
LiveRamp 13
Dotomi 13
Rocket Fuel 13
TubeMogul 12
Casale Media 12
Facebook Exchange (FBX) 12
Right Media 12
Audience Science 12
Krux Digital 12
TradeDesk 12
BidSwitch 11
Datalogix 11
Videology 11
RUN 11
DataXu 11
Twitter Button 11
[x+1] 11
Adap.tv 11
Taboola 11
eXelate 11
Integral Ad Science 11
BrightRoll 10
Omniture (Adobe Analytics) 10
New Relic 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment