1(function () { 2 'use strict'; 3 var slug = document.body.getAttribute('data-article-slug'); 4 if (!slug) return; 5 var params = new URLSearchParams(location.search); 6 var source = 'direct'; 7 var medium = 'none'; 8 var host = ''; 9 try { host = new URL(document.referrer).hostname; } catch (e) {} 10 if (['gclid', 'gbraid', 'wbraid', 'msclkid'].some(function (key) { return params.has(key); })) { 11 source = params.has('msclkid') ? 'bing' : 'google'; medium = 'paid'; 12 } else if (params.has('utm_source') || params.has('utm_medium')) { 13 source = 'campaign'; medium = 'tagged'; 14 } else if (/(^|\.)google\.(com|[a-z]{2}|co\.[a-z]{2}|com\.[a-z]{2})$/.test(host)) { 15 source = 'google'; medium = 'organic'; 16 } else if (/(^|\.)(bing\.com|baidu\.com|duckduckgo\.com)$/.test(host)) { 17 source = host.includes('bing') ? 'bing' : host.includes('baidu') ? 'baidu' : 'duckduckgo'; medium = 'organic'; 18 } else if (host === 'quickrouter.ai' || host.endsWith('.quickrouter.ai') || host === location.hostname) { 19 source = 'quickrouter'; medium = 'internal'; 20 } else if (host) { 21 source = 'external'; medium = 'referral'; 22 } 23 // Emit only bounded metadata; never read form values, code contents or URL queries. 24 function emit(name) { 25 var event = { event: 'docs_' + name, article_slug: slug, entry_source: source, entry_medium: medium }; 26 window.dataLayer = window.dataLayer || []; 27 window.dataLayer.push(event); 28 window.dispatchEvent(new CustomEvent('quickrouter:docs-event', { detail: event })); 29 } 30 emit('article_view'); 31 document.addEventListener('click', function (event) { 32 var link = event.target.closest && event.target.closest('a'); 33 if (!link) return; 34 var name = link.getAttribute('data-docs-event'); 35 if (!name && link.closest('.tutorial-download')) name = 'official_download_click'; 36 if (!name && link.classList.contains('header-register')) name = 'key_cta_click'; 37 if (['key_cta_click', 'console_click', 'pricing_click', 'official_download_click'].includes(name)) emit(name); 38 }); 39})();
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.