-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
354 lines (340 loc) · 17.8 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<!-- Copyright 2022 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
<!DOCTYPE html>
<html>
<head>
<title>Noise Lab</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script type="module" src="js/main.js" defer></script>
<script type="text/javascript" src="./third_party/xlsx.full.min.js"></script>
<script defer src="./third_party/pyscript.js"></script>
<script src="js/python-file.js"></script>
<link href="./third_party/tabulator.min.css" rel="stylesheet" />
<link rel="stylesheet" href="./third_party/pyscript.css" />
<link rel="stylesheet" href="./style.css" />
<link rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🧪</text></svg>" />
</head>
<body>
<py-script>
print('Hello World, from python!')
</py-script>
<py-config>
packages = ["matplotlib", "pandas", "numpy"]
</py-config>
<!-- Content of the py-script below will be populated from python-file.js -->
<py-script id="py-script">
</py-script>
<div id="menu">
<div class="flex">
<div class="app-name">
🧪 Noise Lab
<!-- Version number is programmatically -->
<div id="app-version" class="version"></div>
</div>
<div class="app-info">
<div id="about-info">About</div>
<div id="user-guide">How to use Noise Lab?</div>
</div>
</div>
<nav id="nav">
<!-- Populated automatically, see main.js -->
</nav>
<button id="feedback">Give feedback</button>
</div>
<!-- SIMPLE MODE START -->
<div id="simple-mode" class="mode-section">
<div class="launch-panel">
<div class="launch-panel-content-wrapper">
<div class="input-fields">
<h2>Parameters</h2>
<div>
<h3>API parameters</h3>
<div>
<label for="contribution-budget">Contribution budget:</label>
<span id="contribution-budget"></span>
<div class="help" id="help-budget"></div>
</div>
<div>
<label>Epsilon:</label>
<input type="number" max="64" min="0" value="10" id="eps"
oninput="capEpsilon(event, this)" />
<div class="help" id="help-epsilon"></div>
<div class="input-hint below-input">Min: 0, Max: 64</div>
</div>
</div>
<div>
<h3>Your conversion data</h3>
<div>
<label for="event-count-daily-bucket">Average daily attributable conversion
count PER BUCKET:</label>
<select name="event-count-daily-bucket" id="event-count-daily-bucket">
<option value="5">5</option>
<option value="10">10</option>
<option value="100" selected>100</option>
<option value="500">500</option>
<option value="1000">1000</option>
<option value="10000">10000</option>
<option value="100000">100000</option>
</select>
<div class="help" id="help-daily"></div>
</div>
</div>
<div>
<h3>Data you want to track: Measurement goals</h3>
<div>
<div id="metrics"></div>
</div>
</div>
<div>
<h3>Data you want to track: Dimensions</h3>
<div>
<div id="dimensions-table"></div>
</div>
</div>
<div>
<h3>Your aggregation strategy</h3>
<div>
<label for="batching-frequency">Batching frequency:</label>
<!-- Options are populated automatically -->
<select name="batching-frequency" id="batching-frequency-select"></select>
<div class="help" id="help-batching-frequency"></div>
</div>
<div>
<label for="scaling">Scaling:</label>
<select name="scaling" id="scaling">
<option value="1">Yes (recommended)</option>
<option value="0">No</option>
</select>
<div class="help" id="help-scaling"></div>
</div>
<div id="budget-split">
<label class="long">Budget split (used for Scaling):</label>
<div class="help" id="help-budget-split-simple-mode"></div>
<div>
<div class="input-hint">⚠️ The total contribution budget is split across measurement
goals following the percentages below, so the sum of all percentages can't exceed
100.</div>
<div id="budget-split-wrapper-el"><label>Budget % for measurement goal 1:</label><input
id="budget-percent-meas-goal-1" type="number" disabled value="50"><label>Budget
% for measurement goal 2:</label><input id="budget-percent-meas-goal-2"
type="number" disabled value="50"></div>
</div>
</div>
<div>
<label for="key-strategy">Key strategy:</label>
<select name="key-strategy" id="key-strategy-select" disabled></select>
<div class="help" id="help-key-strategy-simple-mode"></div>
<!-- Options are populated automatically -->
</div>
</div>
</div>
<div class="buttons-wrapper-launch-panel">
<button id="button-simulate" class="primary" onclick="simulateAndDisplayResults_simpleMode()">
▶️ SIMULATE
</button>
</div>
</div>
</div>
<main>
<h2>Simulations</h2>
<div class="global-buttons">
<button class="primary" onclick="downloadAllDom()">
⬇️ Download all (.xlsx)
</button>
<button class="secondary destructive" onclick="resetUi()">
🗑 Clear all
</button>
</div>
<div id="empty-state">
<div class="empty-state-inner">
<img src="./assets/test-tube.png" alt="">
<p>
No simulations yet. To generate your first simulation, click the <strong>▶️ SIMULATE</strong>
button at the bottom the <strong>Parameters</strong> panel on the left.
</p>
</div>
</div>
<div class="all-simulations-wrapper" id="all-simulations-wrapper">
</div>
</main>
</div>
<!-- SIMPLE MODE END -->
<!-- ADVANCED MODE START -->
<div id="advanced-mode" class="mode-section">
<div class="launch-panel">
<div class="launch-panel-content-wrapper">
<div class="input-fields">
<h2>Parameters</h2>
<div>
<h3>API Parameters</h3>
<div>
<label for="contribution-budget">Contribution budget:</label>
<span id="contribution-budget"></span>
<div class="help" id="help-budget"></div>
</div>
<div>
<label>Epsilon:</label>
<input type="number" max="64" min="0" value="10" id="eps"
oninput="capEpsilon(event, this)" />
<div class="help" id="help-epsilon"></div>
<div class="input-hint below-input">Min: 0, Max: 64</div>
</div>
</div>
<div>
<h3>Your conversion data</h3>
<label for="event-count-daily-total">TOTAL daily attributable conversion
count:</label>
<select name="event-count-daily-total" id="event-count-daily-total" oninput="updateDailyPerBucket()">
<option value="5">5</option>
<option value="10">10</option>
<option value="100">100</option>
<option value="500">500</option>
<option value="1000" selected>1000</option>
<option value="10000">10000</option>
<option value="100000">100000</option>
</select>
<div class="help" id="help-daily-total"></div>
<label for="event-count-daily-bucket">Average daily attributable conversion
count PER BUCKET:</label>
<input name="event-count-daily-bucket" id="event-count-daily-bucket" disabled>
</input>
<div class="help" id="help-daily"></div>
<label for="zero-pct"> Percentage of buckets with 0 conversions: </label>
<input name="zero-pct" id="zero-pct" type="number" value="0" min="0" max="10"></input>
<div class="help" id="help-zero-pct"></div>
<div class="input-hint below-input">Min: 0, Max: 10</div>
</div>
<div id="metrics-params">
<h3>Data you want to track: Measurement goals</h3>
<details open>
<summary>
<div class="ternary-xs">
Show/Hide measurement goals
</div>
</summary>
<div class="details-wrapper">
<label> Number of measurement goals:</label><input type="number" value="2"
id="metrics-number" min="0" />
<br />
<div id="metrics-div"></div>
<div id="metrics-buttons-div"></div>
</div>
</details>
</div>
<div id="dimensions">
<h3>Data you want to track: Dimensions</h3>
<details open>
<summary>
<div class="ternary-xs">
Show/Hide dimensions
</div>
</summary>
<div class="details-wrapper">
<label>Number of dimensions to track:</label>
<input type="number" id="dimensions-number" name="dimensions-number" />
<div id="dimensions-div"></div>
<div id="dimensions-buttons-div"></div>
</div>
</details>
</div>
<div>
<h3>Your aggregation strategy</h3>
<div>
<label for="batching-frequency">Batching frequency:</label>
<select name="batching-frequency" id="batching-frequency-select"></select>
<div class="help" id="help-batching-frequency"></div>
<!-- Options are populated automatically -->
</div>
<div>
<label for="scaling">Scaling:</label>
<select name="scaling" id="scaling">
<option value="1">Yes (recommended)</option>
<option value="0">No</option>
</select>
<div class="help" id="help-scaling"></div>
</div>
<div id="budget-split">
<label class="long">Budget split (used for Scaling):</label>
<div>
<div id="budget-split-options-selection">
<p>Please how you prefer to split the budget:</p>
<input type="radio" id="percentage" name="budget-split-option" value="percentage"
onclick="resetBudgetSplit()" checked>
<label for="percentage">percentage</label><br>
<input type="radio" id="value" name="budget-split-option" value="value"
onclick="resetBudgetSplit()">
<label for="value">value</label><br>
</div>
<div class="input-hint">⚠️ The total contribution budget is split across measurement
goals following the percentages/values below, so the sum of all percentages/values
can't exceed
100/total contribution budget.</div>
<div class="input-hint" id="help-budget-split-warning" hidden> ⚠️ Because you're using
Key Strategy 'B' the total contribution budget is now evenly split between all
sub-keys. Note that the total number of sub-keys is: (number of key structures per
measurement goal) * (number of measurement goals). </div>
<div id="budget-split-wrapper-el"></div>
</div>
</div>
<div>
<label for="key-strategy">Key strategy:</label>
<!-- Options are populated automatically -->
<select name="key-strategy" id="key-strategy-select"></select>
<div class="help" id="help-key-strategy-advanced-mode"></div>
</div>
</div>
<div id="granular" hidden>
<h4>Key structures</h4>
<label>Enter number of key structures you want to
use:</label>
<input type="number" id="structures-number" name="structures-number" min="2" value="2" />
<div class="help" id="help-key-strategy-number"></div>
<button class="ternary" onclick="generateKeyStructures()">
Generate key structures
</button>
<div id="strategies"></div>
</div>
</div>
<div class="buttons-wrapper-launch-panel">
<button class="primary" onclick="simulateAndDisplayResults_advancedMode()">
▶️ Simulate
</button>
</div>
</div>
</div>
<main>
<div id="form-validation-wrapper" class="hidden"></div>
<h2>Simulations</h2>
<div class="global-buttons">
<button class="primary" onclick="downloadAllDom()">
⬇️ Download all (.xlsx)
</button>
<button class="secondary destructive" onclick="resetUi()">
🗑 Clear all
</button>
</div>
<div id="empty-state">
<div class="empty-state-inner">
<img src="./assets/test-tube.png" alt="">
<p>
No simulations yet. To generate your first simulation, click the <strong>▶️ SIMULATE</strong>
button at the bottom the <strong>Parameters</strong> panel on the left.
</p>
</div>
</div>
<div class="all-simulations-wrapper" id="all-simulations-wrapper"></div>
</main>
</div>
</body>
</html>