PageSourceSearch

https://uprav.ru/local/templates/uprav_2026/assets/js/analytics/goal.js

js uprav.ru collected 2026-10-03 23:46:14 UTC 1,714 bytes, 57 lines download raw bytes

1(function (window, document) {
2    const send = (goalName) => {
3        const counterId = window.Ya?.Metrika2?.counters?.()?.[0]?.id;
4
5        if (!counterId || typeof window.ym !== 'function') {
6            return;
7        }
8
9        const goals = Array.isArray(goalName) ? goalName : [goalName];
10
11        goals.forEach((goal) => {
12            window.ym(counterId, 'reachGoal', goal);
13        });
14    };
15
16    const initEventClick = () => {
17        const data = {
18            'messeng': '.footer-socials__item a, .messenger_header',
19            'email': '[data-goal-email]',
20            'phone': '[data-goal-phone]',
21            'sendclik': '[data-goal-sendclik]'
22        };
23
24        for (const goalName in data) {
25            const links = document.querySelectorAll(data[goalName]);
26
27            if (links) {
28                links.forEach(link => {
29                    link.addEventListener('click', () => {
30                        send(goalName);
31                    });
32                });
33            }
34        }
35    };
36
37    const getYandexClientId = () => {
38        return new Promise((resolve) => {
39            const counterId = window.Ya?.Metrika2?.counters?.()?.[0]?.id;
40
41            if (counterId && typeof window.ym === 'function') {
42                window.ym(counterId, 'getClientID', resolve);
43                return;
44            }
45
46            resolve(null);
47        });
48    }
49
50    document.addEventListener('DOMContentLoaded', () => {
51        window.AppUprav = window.AppUprav || {};
52        window.AppUprav.sendGoal = send;
53        window.AppUprav.getYandexClientId = getYandexClientId;
54
55        initEventClick();
56    });
57})(window, document);

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.