PageSourceSearch

https://www.gantuning.ru/themes/gantuning/assets/js/webvitals.js

js gantuning.ru collected 2026-10-07 23:02:25 UTC 1,999 bytes, 64 lines download raw bytes

1(function () {
2    var script = document.createElement('script');
3    script.src = 'https://unpkg.com/web-vitals@4/dist/web-vitals.iife.js';
4    script.onload = function () {
5      	webVitals.onCLS((metric) => {
6			console.log(metric)
7			metric.customEntries = metric.entries.map(entry => {
8				return {
9					...entry,
10					elementId: entry.target ? entry.target.id || null : null,
11					elementClass: entry.target ? entry.target.className || null : null,
12					pageUri: window.location.href,
13				};
14			});
15			sendVitalsPostRequest(metric);
16		});
17      	// webVitals.onINP((metric) => {
18		// 	metric.customEntries = metric.entries.map(entry => {
19		// 		return {
20		// 			...entry,
21		// 			elementId: entry.target ? entry.target.id || null : null,
22		// 			elementClass: entry.target ? entry.target.className || null : null,
23		// 		};
24		// 	});
25		// 	sendVitalsPostRequest(metric);
26		// });
27      	// webVitals.onLCP((metric) => {
28		// 	console.log(metric)
29		// 	metric.customEntries = metric.entries.map(entry => {
30		// 		return {
31		// 			...entry,
32		// 			elementId: entry.target ? entry.target.id || null : null,
33		// 			elementClass: entry.target ? entry.target.className || null : null,
34		// 			pageUri: window.location.href,
35		// 		};
36		// 	});
37		// 	sendVitalsPostRequest(metric);
38		// });
39    };
40    document.head.appendChild(script);
41})();
42
43async function sendVitalsPostRequest(data) {
44    const url = 'https://webvitals.amcreative.ru';
45
46    try {
47        const response = await fetch(url, {
48            method: 'POST',
49            headers: {
50                'Content-Type': 'application/json'
51            },
52            body: JSON.stringify(data)
53        });
54
55        if (!response.ok) {
56            throw new Error(`HTTP error! status: ${response.status}`);
57        }
58
59        const result = await response.json();
60        //console.log('Response:', result);
61    } catch (error) {
62        //console.error('Error:', error);
63    }
64}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.