-
Notifications
You must be signed in to change notification settings - Fork 0
/
page_analyzer.html
424 lines (381 loc) · 23.4 KB
/
page_analyzer.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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- <script type="text/javascript" src="server.js"></script> -->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<title>Page Load time analyzer</title>
<!-- <style>
#myDIV {
width: 100%;
padding: 50px 0;
text-align: center;
background-color: lightblue;
margin-top: 20px;
}
</style> -->
</head>
<body>
<div class="container">
<form action = '/' method='post'>
<div class="form-group">
<label for="inputUrl">Enter the URL</label>
<input type="text" class="form-control" name="urlname" placeholder="Enter the url">
</div>
<button type="submit" class="btn btn-primary" onclick="myFunction()">Analyze</button>
</form>
<div id="myDIV">
<div id='ld' style="display:none"><%= loadtime %></div>
<div id='ttfb' style="display:none"><%= ttfb %></div>
<div id='str' style="display:none"><%= st_render %></div>
<div id='visComp' style="display:none"><%= visual_comp %></div>
<div id='fl' style="display:none"><%= full_load %></div>
<div id='ld_ad' style="display:none"><%= loadtime_ad %></div>
<div id='ttfb_ad' style="display:none"><%= ttfb_ad %></div>
<div id='str_ad' style="display:none"><%= st_render_ad %></div>
<div id='visComp_ad' style="display:none"><%= visual_comp_ad %></div>
<div id='fl_ad' style="display:none"><%= full_load_ad %></div>
<div id="chart_div"></div>
</div>
<div id="myDIV_1">
<div id='bytes_in_doc' style="display:none"><%= bytes_in_doc %></div>
<div id='req_docs' style="display:none"><%= req_docs %></div>
<div id='doctime' style="display:none"><%= doctime %></div>
<div id='bytes_in_doc_ad' style="display:none"><%= bytes_in_doc_ad %></div>
<div id='req_docs_ad' style="display:none"><%= req_docs_ad %></div>
<div id='doctime_ad' style="display:none"><%= doctime_ad %></div>
<div id="chart_div_1"></div>
</div>
<div id="myDIV_2">
<div id='bytes_in' style="display:none"><%= bytes_in %></div>
<div id='req' style="display:none"><%= requests %></div>
<div id='fulltime' style="display:none"><%= fully_loaded %></div>
<div id='bytes_in_ad' style="display:none"><%= bytes_in_ad %></div>
<div id='req_ad' style="display:none"><%= requests_ad %></div>
<div id='fulltime_ad' style="display:none"><%= fully_loaded_ad %></div>
<div id="chart_div_2"></div>
<div id='html_req' style="display:none"><%= html_req %></div>
<div id='js_req' style="display:none"><%= js_req %></div>
<div id='css_req' style="display:none"><%= css_req %></div>
<div id='image_req' style="display:none"><%= image_req %></div>
<div id='flash_req' style="display:none"><%= flash_req %></div>
<div id='video_req' style="display:none"><%= video_req %></div>
<div id='other_req' style="display:none"><%= other_req %></div>
<div id='font_req' style="display:none"><%= font_req %></div>
<div id='html_bytes' style="display:none"><%= html_bytes %></div>
<div id='js_bytes' style="display:none"><%= js_bytes %></div>
<div id='css_bytes' style="display:none"><%= css_bytes %></div>
<div id='image_bytes' style="display:none"><%= image_bytes %></div>
<div id='flash_bytes' style="display:none"><%= flash_bytes %></div>
<div id='video_bytes' style="display:none"><%= video_bytes %></div>
<div id='other_bytes' style="display:none"><%= other_bytes %></div>
<div id='font_bytes' style="display:none"><%= font_bytes %></div>
<div id='html_req_ad' style="display:none"><%= html_req_ad %></div>
<div id='js_req_ad' style="display:none"><%= js_req_ad %></div>
<div id='css_req_ad' style="display:none"><%= css_req_ad %></div>
<div id='image_req_ad' style="display:none"><%= image_req_ad %></div>
<div id='flash_req_ad' style="display:none"><%= flash_req_ad %></div>
<div id='video_req_ad' style="display:none"><%= video_req_ad %></div>
<div id='other_req_ad' style="display:none"><%= other_req_ad %></div>
<div id='font_req_ad' style="display:none"><%= font_req_ad %></div>
<div id='html_bytes_ad' style="display:none"><%= html_bytes_ad %></div>
<div id='js_bytes_ad' style="display:none"><%= js_bytes_ad %></div>
<div id='css_bytes_ad' style="display:none"><%= css_bytes_ad %></div>
<div id='image_bytes_ad' style="display:none"><%= image_bytes_ad %></div>
<div id='flash_bytes_ad' style="display:none"><%= flash_bytes_ad %></div>
<div id='font_bytes_ad' style="display:none"><%= font_bytes_ad %></div>
<div id='video_bytes_ad' style="display:none"><%= video_bytes_ad %></div>
<div id='other_bytes_ad' style="display:none"><%= other_bytes_ad %></div>
<table class="columns">
<tr>
<!--<td><div id="Sarah_chart_div" style="border: 1px solid #ccc"></div></td>
<td><div id="Anthony_chart_div" style="border: 1px solid #ccc"></div></td>
-->
<td><div id="piechart_ad" style="border: 1px solid #ccc; width: 540px; height: 300px;"></div></td>
<td><div id="piechart" style="border: 1px solid #ccc; width: 540px; height: 300px;"></div></td>
</tr>
</table>
<table class="columns">
<tr>
<!--<td><div id="Sarah_chart_div" style="border: 1px solid #ccc"></div></td>
<td><div id="Anthony_chart_div" style="border: 1px solid #ccc"></div></td>
-->
<td><div id="piechart_bytes_ad" style="border: 1px solid #ccc; width: 540px; height: 300px;"></div></td>
<td><div id="piechart_bytes" style="border: 1px solid #ccc; width: 540px; height: 300px;"></div></td>
</tr>
</table>
</div>
</div>
<script>
function myFunction() {
var x = document.getElementById("myDIV");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
var y = document.getElementById("myDIV_1");
if (y.style.display === "none") {
y.style.display = "block";
} else {
y.style.display = "none";
}
var z = document.getElementById("myDIV_2");
if (z.style.display === "none") {
z.style.display = "block";
} else {
z.style.display = "none";
}
}
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawAnnotations);
function drawAnnotations() {
var data = google.visualization.arrayToDataTable([
['Summary', 'With Adblock', 'Without Adblock'],
['Load Time', parseInt(document.getElementById('ld').textContent), parseInt(document.getElementById('ld_ad').textContent)],
['First Byte', parseInt(document.getElementById('ttfb').textContent), parseInt(document.getElementById('ttfb_ad').textContent)],
['Start Render', parseInt(document.getElementById('str').textContent), parseInt(document.getElementById('str_ad').textContent)],
['Visually Complete', parseInt(document.getElementById('visComp').textContent), parseInt(document.getElementById('visComp_ad').textContent)],
['Fully Loaded', parseInt(document.getElementById('fl').textContent), parseInt(document.getElementById('fl_ad').textContent)]
]);
var data = google.visualization.arrayToDataTable([
['Summary', 'With Adblock', {type: 'string', role: 'annotation'},
'Without Adblock', {type: 'string', role: 'annotation'}],
['Load Time', parseInt(document.getElementById('ld').textContent), document.getElementById('ld').textContent, parseInt(document.getElementById('ld_ad').textContent), document.getElementById('ld_ad').textContent],
['First Byte', parseInt(document.getElementById('ttfb').textContent), document.getElementById('ttfb').textContent, parseInt(document.getElementById('ttfb_ad').textContent), document.getElementById('ttfb_ad').textContent],
['Start Render', parseInt(document.getElementById('str').textContent), document.getElementById('str').textContent, parseInt(document.getElementById('str_ad').textContent), document.getElementById('str_ad').textContent],
['Visually Complete', parseInt(document.getElementById('visComp').textContent), document.getElementById('visComp').textContent, parseInt(document.getElementById('visComp_ad').textContent), document.getElementById('visComp_ad').textContent],
['Fully Loaded', parseInt(document.getElementById('fl').textContent), document.getElementById('fl').textContent, parseInt(document.getElementById('fl_ad').textContent), document.getElementById('fl_ad').textContent]
]);
var options = {
title: 'Summary of Various Metrics',
chartArea: {width: '50%'},
annotations: {
alwaysOutside: true,
textStyle: {
fontSize: 12,
auraColor: 'none',
color: '#555'
},
boxStyle: {
stroke: '#ccc',
strokeWidth: 1,
gradient: {
color1: '#f3e5f5',
color2: '#f3e5f5',
x1: '0%', y1: '0%',
x2: '100%', y2: '100%'
}
}
},
hAxis: {
title: 'Time in milliseconds',
minValue: 0,
},
vAxis: {
title: 'Metrics'
}
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawAnnotations_1);
function drawAnnotations_1() {
var data = google.visualization.arrayToDataTable([
['Document Complete', 'With Adblock', 'Without Adblock'],
['Document Load time in ms', parseInt(document.getElementById('doctime').textContent), parseInt(document.getElementById('doctime_ad').textContent)],
['Requests', parseInt(document.getElementById('req_docs').textContent), parseInt(document.getElementById('req_docs_ad').textContent)],
['Bytes in KB', parseInt(document.getElementById('bytes_in_doc').textContent)/1024, parseInt(document.getElementById('bytes_in_doc_ad').textContent)/1024],
]);
var data = google.visualization.arrayToDataTable([
['Document Complete', 'With Adblock', {type: 'string', role: 'annotation'},
'Without Adblock', {type: 'string', role: 'annotation'}],
['Document Load time in ms', parseInt(document.getElementById('doctime').textContent), document.getElementById('doctime').textContent, parseInt(document.getElementById('doctime_ad').textContent), document.getElementById('doctime_ad').textContent],
['Requests', parseInt(document.getElementById('req_docs').textContent), document.getElementById('req_docs').textContent, parseInt(document.getElementById('req_docs_ad').textContent), document.getElementById('req_docs_ad').textContent],
['Bytes in KB', parseInt(document.getElementById('bytes_in_doc').textContent)/1024, document.getElementById('bytes_in_doc').textContent, parseInt(document.getElementById('bytes_in_doc_ad').textContent)/1024, document.getElementById('bytes_in_doc_ad').textContent],
]);
var options = {
title: 'Document Complete Metrics',
chartArea: {width: '50%'},
annotations: {
alwaysOutside: true,
textStyle: {
fontSize: 12,
auraColor: 'none',
color: '#555'
},
boxStyle: {
stroke: '#ccc',
strokeWidth: 1,
gradient: {
color1: '#f3e5f5',
color2: '#f3e5f5',
x1: '0%', y1: '0%',
x2: '100%', y2: '100%'
}
}
},
hAxis: {
title: '',
minValue: 0,
},
vAxis: {
title: 'Metrics'
}
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div_1'));
chart.draw(data, options);
}
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawAnnotations_2);
function drawAnnotations_2() {
var data = google.visualization.arrayToDataTable([
['Page Load Complete', 'With Adblock', 'Without Adblock'],
['Full Load time in ms', parseInt(document.getElementById('fulltime').textContent), parseInt(document.getElementById('fulltime_ad').textContent)],
['Requests', parseInt(document.getElementById('req').textContent), parseInt(document.getElementById('req_ad').textContent)],
['Bytes in KB', parseInt(document.getElementById('bytes_in').textContent)/1024, parseInt(document.getElementById('bytes_in_ad').textContent)/1024],
]);
var data = google.visualization.arrayToDataTable([
['Page Load Complete', 'With Adblock', {type: 'string', role: 'annotation'},
'Without Adblock', {type: 'string', role: 'annotation'}],
['Full Load time in ms', parseInt(document.getElementById('fulltime').textContent), document.getElementById('fulltime').textContent, parseInt(document.getElementById('fulltime_ad').textContent), document.getElementById('fulltime_ad').textContent],
['Requests', parseInt(document.getElementById('req').textContent), document.getElementById('req').textContent, parseInt(document.getElementById('req_ad').textContent), document.getElementById('req_ad').textContent],
['Bytes in KB', parseInt(document.getElementById('bytes_in').textContent)/1024, document.getElementById('bytes_in').textContent, parseInt(document.getElementById('bytes_in_ad').textContent)/1024, document.getElementById('bytes_in_ad').textContent],
]);
var options = {
title: 'Full Page Load Complete Metrics',
chartArea: {width: '50%'},
annotations: {
alwaysOutside: true,
textStyle: {
fontSize: 12,
auraColor: 'none',
color: '#555'
},
boxStyle: {
stroke: '#ccc',
strokeWidth: 1,
gradient: {
color1: '#f3e5f5',
color2: '#f3e5f5',
x1: '0%', y1: '0%',
x2: '100%', y2: '100%'
}
}
},
hAxis: {
title: '',
minValue: 0,
},
vAxis: {
title: 'Metrics'
}
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div_2'));
chart.draw(data, options);
}
</script>
<script>
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['MIME Type', 'Number of Requests'],
['html', parseInt(document.getElementById('html_req').textContent)],
['js', parseInt(document.getElementById('js_req').textContent)],
['css', parseInt(document.getElementById('css_req').textContent)],
['image', parseInt(document.getElementById('image_req').textContent)],
['flash', parseInt(document.getElementById('flash_req').textContent)],
['font', parseInt(document.getElementById('video_req').textContent)],
['video', parseInt(document.getElementById('video_req').textContent)],
['other', parseInt(document.getElementById('other_req').textContent)]
]);
var options = {
title: 'Requests by Resource type (Adblock)',
is3D: 'true',
pieSliceText: 'value',
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
<script>
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['MIME Type', 'Number of Requests'],
['html', parseInt(document.getElementById('html_req_ad').textContent)],
['js', parseInt(document.getElementById('js_req_ad').textContent)],
['css', parseInt(document.getElementById('css_req_ad').textContent)],
['image', parseInt(document.getElementById('image_req_ad').textContent)],
['flash', parseInt(document.getElementById('flash_req_ad').textContent)],
['font', parseInt(document.getElementById('video_req_ad').textContent)],
['video', parseInt(document.getElementById('video_req_ad').textContent)],
['other', parseInt(document.getElementById('other_req_ad').textContent)]
]);
var options = {
title: 'Requests by Resource type (Standard)',
is3D: 'true',
pieSliceText: 'value',
};
var chart = new google.visualization.PieChart(document.getElementById('piechart_ad'));
chart.draw(data, options);
}
</script>
<script>
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['MIME Type', 'Number of Bytes'],
['html', parseInt(document.getElementById('html_bytes').textContent)],
['js', parseInt(document.getElementById('js_bytes').textContent)],
['css', parseInt(document.getElementById('css_bytes').textContent)],
['image', parseInt(document.getElementById('image_bytes').textContent)],
['flash', parseInt(document.getElementById('flash_bytes').textContent)],
['font', parseInt(document.getElementById('font_bytes').textContent)],
['video', parseInt(document.getElementById('video_bytes').textContent)],
['other', parseInt(document.getElementById('other_bytes').textContent)]
]);
var options = {
title: 'Weight by Resource type (Adblock)',
is3D: 'true',
pieSliceText: 'value',
};
var chart = new google.visualization.PieChart(document.getElementById('piechart_bytes'));
chart.draw(data, options);
}
</script>
<script>
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['MIME Type', 'Number of Bytes'],
['html', parseInt(document.getElementById('html_bytes_ad').textContent)],
['js', parseInt(document.getElementById('js_bytes_ad').textContent)],
['css', parseInt(document.getElementById('css_bytes_ad').textContent)],
['image', parseInt(document.getElementById('image_bytes_ad').textContent)],
['flash', parseInt(document.getElementById('flash_bytes_ad').textContent)],
['font', parseInt(document.getElementById('font_bytes_ad').textContent)],
['video', parseInt(document.getElementById('video_bytes_ad').textContent)],
['other', parseInt(document.getElementById('other_bytes_ad').textContent)]
]);
var options = {
title: 'Weight by Resource type (Standard)',
is3D: 'true',
pieSliceText: 'value',
};
var chart = new google.visualization.PieChart(document.getElementById('piechart_bytes_ad'));
chart.draw(data, options);
}
</script>
</body>
</html>