-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopen.html
More file actions
70 lines (66 loc) · 2.19 KB
/
open.html
File metadata and controls
70 lines (66 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
layout: default
title: Open stats page
description:
I believe that transparency is really important, so I have made this page
so that you can see how much traffic Code The Web gets. Let me know if you
would like me to add anything.
---
<link rel="stylesheet" href="/assets/css/open.css?v=1" />
<div class="open-page-wrapper">
<div class="open-page">
<a href="/" class="home-link">← Back to Home</a>
<h1>Open stats page</h1>
<p>
I believe that transparency is really important, so I have made this page
so that you can see how much traffic Code The Web gets. Let me know if you
would like me to add anything.
</p>
<div class="open-grid">
<div class="open-grid-item">
<div class="open-grid-item-number" id="all-time-users">…</div>
<div class="open-grid-item-text">
All-time visitors
<span class="open-grid-item-text-updated">(updated daily)</span>
</div>
</div>
<div class="open-grid-item">
<div class="open-grid-item-number" id="all-time-pageviews">
…
</div>
<div class="open-grid-item-text">
All-time page views
<span class="open-grid-item-text-updated">(updated daily)</span>
</div>
</div>
<div class="open-grid-item">
<div class="open-grid-item-number" id="last-30-days-ad-revenue">
…
</div>
<div class="open-grid-item-text">
Ad revenue in the last 30 days
<span class="open-grid-item-text-updated">(updated daily)</span>
</div>
</div>
</div>
</div>
</div>
<script>
/* https://stackoverflow.com/a/2901298 */
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
fetch("/api/open/")
.then(r => r.json())
.then(r => {
document.getElementById("all-time-users").innerText = numberWithCommas(
r.allTimeUsers
);
document.getElementById(
"all-time-pageviews"
).innerText = numberWithCommas(r.allTimePageViews);
document.getElementById(
"last-30-days-ad-revenue"
).innerText = '$' + numberWithCommas(r.last30DaysAdRevenue);
});
</script>