PageSourceSearch

https://www.runchatcapture.com/play/shared/telemetry.js

js runchatcapture.com collected 2026-10-02 01:42:21 UTC 2,021 bytes, 57 lines download raw bytes

1// telemetry.js (shared)
2// Fires a single session-deduplicated hit per page to the RCC analytics backend.
3// Fully silent — no error can surface to the user or affect page behavior.
4// Usage: <script src="path/to/telemetry.js" data-page="your-page-key"></script>
5
6(function() {
7  try {
8    var pageKey = document.currentScript && document.currentScript.getAttribute('data-page');
9    if (!pageKey) return;
10
11    var HIT_KEY = 'rcc_hit_' + pageKey;
12
13    // sessionStorage can throw in Safari private mode or when blocked by policy
14    var alreadyHit = false;
15    try { alreadyHit = !!sessionStorage.getItem(HIT_KEY); } catch(e) { return; }
16    if (alreadyHit) return;
17
18    // Retrieve or generate a session ID shared across all pages in this tab
19    var sessionId;
20    try {
21      sessionId = sessionStorage.getItem('rcc_session_id');
22      if (!sessionId) {
23        sessionId = typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
24          ? crypto.randomUUID()
25          : 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
26              var r = Math.random() * 16 | 0;
27              return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
28            });
29        try { sessionStorage.setItem('rcc_session_id', sessionId); } catch(e) {}
30      }
31    } catch(e) {
32      sessionId = 'no-storage';
33    }
34
35    fetch('https://cc-contexto-d01a6bbfa039.herokuapp.com/page-hit', {
36      method: 'POST',
37      headers: { 'Content-Type': 'application/json' },
38      body: JSON.stringify({
39        page: pageKey,
40        path: window.location.pathname,
41        timestamp: new Date().toISOString(),
42        sessionId: sessionId,
43        referrer: document.referrer || null
44      }),
45      keepalive: true
46    })
47    .then(function(r) {
48      if (r.ok) {
49        try { sessionStorage.setItem(HIT_KEY, '1'); } catch(e) {}
50      }
51    })
52    .catch(function() {}); // network failures are fully silent
53
54  } catch(e) {
55    // Outer catch: nothing from telemetry can ever reach the user
56  }
57})();

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.