PageSourceSearch

https://gkdialog.info/include/storefront-events.js?v=20261005-1

js gkdialog.info collected 2026-10-07 18:07:52 UTC 5,907 bytes, 80 lines download raw bytes

1/* Funnel events only: never read names, contacts, form values, query strings or request IDs. */
2(() => {
3  'use strict';
4  const goals=new Set(['gkd_messenger_click','gkd_phone_click','gkd_service_click','gkd_form_start','gkd_request_saved','gkd_form_error']);
5  const kinds=new Set(['sro-insurance','sro-extract','fedresurs','sro-admission','signature','office','nok','nrs-check','nrs-reserve','nrs-selection','business','digital','registry','messenger','chat-widget','callback','phone','other']);
6  function safeEvent(goal,kind,path) {
7    if(!goals.has(goal))return null;
8    const section=/^\/(services|articles|news|product|contacts)(?:\/|$)/.exec(String(path||''));
9    return {goal,params:{service:kinds.has(kind)?kind:'other',section:section?section[1]:'other'}};
10  }
11  function linkKind(value) {
12    let u;try{u=new URL(value,'https://gkdialog.info');}catch{return null;}
13    if(u.protocol==='tel:')return ['gkd_phone_click','phone'];
14    if(u.origin==='https://chat.gkdialog.info'&&u.pathname==='/join/dialog')return ['gkd_messenger_click','messenger'];
15    if(u.origin==='https://360.gkdialog.info'){
16      const direct={'/nrs-check':'nrs-check','/nrs-reserve':'nrs-reserve','/nrs-market/request':'nrs-selection','/signature-order/start':'signature','/mycompany/sro-extracts/new':'sro-extract'};
17      const fns=['ooo','ip','okved','address-change','name-change','standard-charter','ip-close'].some(kind=>u.pathname==='/fns-registration/'+kind);
18      const kind=direct[u.pathname]||(fns?'business':null);
19      return kind?['gkd_service_click',kind]:null;
20    }
21    if(u.origin!=='https://gkdialog.info')return null;
22    if(u.pathname==='/product/' && u.hash==='#signature-calculator')return ['gkd_service_click','signature'];
23    if(u.pathname==='/product/' && u.hash==='#dialog-products-title')return ['gkd_service_click','digital'];
24    if(['/product/dialog-messenger/','/product/dialog-drive/','/product/dialog-360/'].includes(u.pathname))return ['gkd_service_click','digital'];
25    if(u.pathname==='/services/sro/dogovor-strakhovaniya-sro/')return ['gkd_service_click','sro-insurance'];
26    if(u.pathname==='/services/distantsionnye-uslugi/zayavka-na-publikatsiyu-v-fedresurse/')return ['gkd_service_click','fedresurs'];
27    return ({'/services/sro/zayavka-na-vstuplenie-v-sro/':['gkd_service_click','sro-admission'],'/services/distantsionnye-uslugi/prodlenie-kep/':['gkd_service_click','signature'],'/services/reestr-chlenov-sro/':['gkd_service_click','registry'],'/services/nok/':['gkd_service_click','nok'],'/services/sro/arenda-spetsialistov-nrs/':['gkd_service_click','nrs-selection'],'/services/otkrytie-biznesa/':['gkd_service_click','business']})[u.pathname]||null;
28  }
29  function chatIntent(label,href,explicit) {
30    if(href && /^(?:tel:|mailto:|javascript:)/i.test(href))return false;
31    const match=href?linkKind(href):null;
32    const name=String(label||'').toLowerCase().replace(/[\s\u00a0]+/g,' ').trim().replace(/[↗→?!]+$/g,'').trim();
33    return !!explicit || match?.[0]==='gkd_messenger_click' || ['задать свой вопрос','задать вопрос','получить консультацию','написать в диалог','написать нам'].includes(name);
34  }
35  if(typeof module!=='undefined'&&module.exports){module.exports={safeEvent,linkKind,chatIntent};return;}
36  if(window.DialogStorefrontEvents)return;
37  function emit(goal,kind){
38    const event=safeEvent(goal,kind,location.pathname);if(!event||typeof window.ym!=='function')return;
39    try{window.ym(48196238,'reachGoal',event.goal,event.params);}catch(_){} // Analytics must never interrupt an enquiry.
40  }
41  window.DialogStorefrontEvents={emit};
42  function trackClick(event){
43    const host=document.getElementById('dialog-site-widget');
44    const path=event.composedPath?.()||[];
45    if(host && path.includes(host)){
46      const button=path.find(n=>n?.matches?.('button.launcher'));
47      if(button?.getAttribute('aria-expanded')==='false')emit('gkd_messenger_click','chat-widget');
48      return;
49    }
50    const target=event.target.closest?.('a,button,[data-event="jqm"],[data-dialog-chat]');
51    // The widget intercepts consultation CTAs in capture phase; count intention
52    // before its propagation stop, never read any iframe messages or contents.
53    if(host && target && !target.closest('form') && !target.hasAttribute('disabled')
54      && !event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey && event.button===0
55      && chatIntent(target.textContent,target.getAttribute('href'),target.hasAttribute('data-dialog-chat'))){
56      emit('gkd_messenger_click','chat-widget');return;
57    }
58    const a=event.target.closest?.('a[href]');if(!a)return;
59    const match=linkKind(a.href);if(match)emit(...match);
60  }
61  document.addEventListener('click',trackClick,true);
62  const started=new WeakSet(),seenReceipts=new Set();
63  document.addEventListener('input',event=>{
64    const form=event.target.closest?.('form[name="aspro_allcorp3_callback"]');
65    if(form && !started.has(form)){started.add(form);emit('gkd_form_start','callback');}
66  },true);
67  function inspect(root){
68    const nodes=[...(root.matches?.('[data-gk-cms-saved]')?[root]:[]),...(root.querySelectorAll?.('[data-gk-cms-saved]')||[])];
69    for(const node of nodes){
70      const nonce=node.getAttribute('data-gk-cms-saved');
71      if(node.getAttribute('data-gk-cms-kind')!=='callback'|| !/^[a-f0-9]{32}$/.test(nonce||'') || seenReceipts.has(nonce))continue;
72      seenReceipts.add(nonce);emit('gkd_request_saved','callback');
73    }
74  }
75  function initReceipts(){
76    inspect(document);
77    new MutationObserver(changes=>{for(const change of changes)for(const node of change.addedNodes)inspect(node);}).observe(document.body,{childList:true,subtree:true});
78  }
79  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',initReceipts,{once:true});else initReceipts();
80})();

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.