-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
194 lines (175 loc) · 5.42 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Simple Analytics</title>
<meta name="robots" content="noindex,nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Some default metadata -->
<script>window.sa_metadata = { sa_metadata: true };</script>
<!-- Simple Analytics events queue -->
<script>window.sa_event=window.sa_event||function(){var a=[].slice.call(arguments);window.sa_event.q?window.sa_event.q.push(a):window.sa_event.q=[a]};</script>
<style>
/* Basics */
body,
html {
margin: 0;
padding: 0;
height: 100%;
}
body {
background: #eef9ff;
word-break: break-word;
display: flex;
justify-content: center;
align-items: center;
color: #415659;
font-family: "Space Grotesk", Arial, sans-serif;
font-weight: 400;
}
* {
box-sizing: border-box;
}
/* Fonts */
@font-face {
font-family: "Space Grotesk";
font-weight: 500;
src: url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Medium.woff2")
format("woff2"),
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Medium.woff")
format("woff");
}
@font-face {
font-family: "Space Grotesk";
font-weight: 400;
src: url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Regular.woff2")
format("woff2"),
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Regular.woff")
format("woff");
}
h1,
h2,
h3,
h4 {
margin: 0 0 1rem 0;
line-height: 1.5;
font-weight: 500;
}
p {
font-size: 1rem;
line-height: 150%;
}
a {
color: #415659;
}
a:hover {
text-decoration: none;
}
/* Layouts */
main {
padding: 2rem;
flex: 0 1 auto;
text-align: center;
}
@media (prefers-color-scheme: dark) {
body {
background: #2a3638;
}
body,
a {
color: #a4bdc0;
}
}
textarea {
width: 550px;
max-width: 100%;
height: 160px;
padding: 0.5rem;
margin: 1rem;
}
</style>
</head>
<body>
<main>
<svg
width="100px"
height="100px"
enable-background="new 0 0 100 100"
fill="#ff4f64"
version="1.0"
viewBox="0 0 100 100"
xml:space="preserve"
xmlns="http://www.w3.org/2000/svg"
>
<rect x="20" y="53" width="10" height="30" />
<rect x="44" y="35" width="10" height="48" />
<rect x="68" y="18" width="10" height="65" />
</svg>
<h2>Automated events</h2>
<p>A test site to test automated events for Simple Analytics.</p>
<p>
<a href="https://example.com" target="_blank" rel="nofollow noopener">Outbound link</a><br />
<a href="mailto:user@example.com">Email link</a><br />
<a href="/file.pdf">Download PDF link</a>
</p>
<textarea readonly>Loading JavaScript...</textarea>
<p>
In the above console you should see "Auto events" and "Normal embed" script is loaded.<br />
Further you should see events show up when you click the links.
</p>
</main>
<!-- Some test code for this page specifically -->
<script>
document.querySelector("textarea").value = "";
var logger = {
log: console.log,
error: console.error,
warn: console.warn,
info: console.info
};
function log(type = 'info', ...text) {
logger[type](...text);
write(type, ...text)
}
function write(type = 'info', ...params) {
var line = params.map((param) => {
if (!param) return `${param}`;
if (typeof param === 'object') return JSON.stringify(param);
return param;
}).join(' ')
document.querySelector("textarea").value += `${type.toUpperCase()}: ${line}\n`;
}
console.log = function() { write('log', ...arguments); logger.log.apply(console, arguments); };
console.error = function() { write('error', ...arguments); logger.error.apply(console, arguments); };
console.warn = function() { write('warn', ...arguments); logger.warn.apply(console, arguments); };
console.info = function() { write('info', ...arguments); logger.info.apply(console, arguments); };
function scriptLoaded(type, ok) {
if (ok) {
log('info', `${type} script is loaded`);
}
else {
log('error', `${type} script is blocked on your computer`);
}
}
</script>
<!-- Normal collect script -->
<script
async
data-collect-dnt="true"
onerror="scriptLoaded('Normal embed', false)"
onload="scriptLoaded('Normal embed', true)"
src="https://scripts.simpleanalyticscdn.com/latest.js"
></script>
<!-- Auto events script -->
<script
async
data-collect="outbound,emails,downloads"
data-extensions="pdf,csv,docx,xlsx,zip,doc,xls"
data-use-title="true"
data-full-urls="false"
onerror="scriptLoaded('Auto events', false)"
onload="scriptLoaded('Auto events', true)"
src="https://scripts.simpleanalyticscdn.com/auto-events.js"
></script>
</body>
</html>