PageSourceSearch

https://www.effective-group.ru/js/metrika-goals.js

js effective-group.ru collected 2026-10-06 06:59:36 UTC 2,798 bytes, 55 lines download raw bytes

1/* T-128 · Инструментирование целей Яндекс.Метрики (счётчик 42488474).
2   Клики (tel/mailto/контакты), загрузки файлов, копирование контактов, глубина скролла.
3   Один reachGoal на действие; агрегаты в Метрике («содержит form_» / «содержит scroll_75_»)
4   срабатывают автоматически. Отправка форм инструментируется в effective-group.js (submitWebflow).
5   Идентификаторы сверены с конфигом целей — см. tasks/2026-07-05-4/work/ap-03-metrika-changes.md. */
6(function ($) {
7  if (!$) return;
8  var COUNTER = 42488474;
9  function goal(id) {
10    if (typeof ym === 'function') ym(COUNTER, 'reachGoal', id);
11  }
12
13  $(function () {
14    // --- Клики по ссылкам и загрузки файлов (делегирование) ---
15    $(document).on('click', 'a[href]', function () {
16      var href = $(this).attr('href') || '';
17      if (/^tel:/i.test(href)) goal('click_phone');
18      else if (/^mailto:/i.test(href)) goal('click_email');
19      else if (/effective_technologies_portfolio\.pdf/i.test(href)) goal('download_portfolio');
20      else if (/effective_technologies\.pdf/i.test(href)) goal('download_presentation');
21      else if (/anketa/i.test(href)) goal('download_anketa_etp');
22      else if (/contacts\.html/i.test(href)) goal('click_contacts');
23    });
24
25    // --- Копирование телефона / e-mail (по выделению) ---
26    $(document).on('copy', function () {
27      var sel = (window.getSelection && String(window.getSelection())) || '';
28      if (!sel) return;
29      if (/[\w.+-]+@[\w.-]+\.[a-z]{2,}/i.test(sel)) goal('copy_email');
30      else if (/(?:\+?\d[\s()\-]*){7,}/.test(sel)) goal('copy_phone');
31    });
32
33    // --- Глубина просмотра на приоритетных страницах ---
34    var SCROLL_SCOPE = {
35      '/solutions/etp.html': 'ETP',
36      '/solutions/srm.html': 'SRM',
37      '/solutions/low-code.html': 'lowcode',
38      '/solutions/portals.html': 'portals'
39    };
40    var scope = SCROLL_SCOPE[location.pathname];
41    if (scope) {
42      var fired = {}, $w = $(window);
43      var onScroll = function () {
44        var range = $(document).height() - $w.height();
45        if (range <= 0) return;
46        var pct = ($w.scrollTop() / range) * 100;
47        if (pct >= 50 && !fired[50]) { fired[50] = 1; goal('scroll_50_' + scope); }
48        if (pct >= 75 && !fired[75]) { fired[75] = 1; goal('scroll_75_' + scope); }
49        if (fired[50] && fired[75]) $w.off('scroll.mgoals');
50      };
51      $w.on('scroll.mgoals', onScroll);
52      onScroll();
53    }
54  });
55})(window.jQuery);

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.