-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.html
47 lines (40 loc) · 1.4 KB
/
scripts.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
<script>
(function() {
var style = document.body.style;
var supportsFlexbox = 'flexBasis' in style ||
'msFlexAlign' in style || 'webkitBoxDirection' in style;
if (!supportsFlexbox) {
var div = document.createElement('div');
div.className = 'Error';
div.innerHTML = 'Your browser does not support Flexbox. ' +
'Parts of this site may not appear as expected.';
document.body.insertBefore(div, document.body.firstChild);
}
})();
</script>
<script async id="twitter-wjs" src="https://platform.twitter.com/widgets.js"></script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-40829935-1', 'auto');
ga('set', 'dimension1', '1');
ga('set', 'transport', 'beacon');
ga('send', 'pageview');
</script>
<script type="module">
import {getCLS, getFCP, getFID, getLCP, getTTFB} from 'https://unpkg.com/[email protected]/dist/web-vitals.es5.min.js';
function sendToGoogleAnalytics({name, delta, id}) {
ga('send', 'event', {
eventCategory: 'Web Vitals',
eventAction: name,
eventValue: Math.round(name === 'CLS' ? delta * 1000 : delta),
eventLabel: id,
nonInteraction: true,
});
}
getCLS(sendToGoogleAnalytics);
getFCP(sendToGoogleAnalytics);
getFID(sendToGoogleAnalytics);
getLCP(sendToGoogleAnalytics);
getTTFB(sendToGoogleAnalytics);
</script>