-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
81 lines (69 loc) · 2.92 KB
/
index.html
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
71
72
73
74
75
76
77
78
79
80
81
<!doctype html>
<html lang="en-CA">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<title>The Real Hotdog Mark</title>
<meta property="og:url" content="https://therealhotdogmark.com/">
<meta property="og:type" content="website">
<meta property="og:title" content="The Real Hotdog Mark">
<meta property="og:description" content="I'm totally a hotdog! Look at me go!">
<meta property="og:image" content="https://therealhotdogmark.com/images/share-photo.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<link href="https://fonts.googleapis.com/css?family=Chewy|Press+Start+2P|Gaegu:700" rel="stylesheet">
<link href="./css/normalize.css" type="text/css" rel="stylesheet">
<link href="./css/main.css" type="text/css" rel="stylesheet">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-EWT6Q3C2WB"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag("js", new Date());
gtag("config", "G-EWT6Q3C2WB"); // Google Tag ID (for Google Analytics 4)
</script>
</head>
<body>
<div class="container" role="main">
<h1>The Real Hotdog Mark</h1>
<figure>
<img src="./images/hotdog-mark.gif" width="400" height="400" alt="Mark dancing while wearing a hotdog suit" />
<figcaption>Look at me go!</figcaption>
</figure>
<p class="counter-message">
You are visitor number: <span class="visitor-number visually-hidden">0</span>
<span class="counter" aria-hidden="true">
<span class="number">0</span>
<span class="number">0</span>
<span class="number">0</span>
<span class="number">0</span>
<span class="number">0</span>
</span>
</p>
</div>
<script>
fetch("/api")
.then(response => response.json())
.then(json => {
let { totalUsers = 0 } = json;
// TODO: remove this when I've migrated the data from Universal Analytics to GA4
totalUsers += 470;
const totalUsersPadded = `${totalUsers}`.padStart(5, "0");
const visitorContainer = document.querySelector(".visitor-number");
if (visitorContainer) visitorContainer.textContent = totalUsers;
const counterContainer = document.querySelector(".counter");
if (!counterContainer) return;
counterContainer.innerHTML = "";
totalUsersPadded.split("").forEach(num => {
const span = document.createElement("span");
span.classList.add("number");
span.textContent = num;
counterContainer.appendChild(span);
});
})
.catch(error => {
console.error(error);
});
</script>
</body>
</html>