PageSourceSearch

https://uws-technologie.de/wp-content/plugins/fley-functions/assets/js/ga-click-tracking.js?ver=1.0

js uws-technologie.de collected 2026-10-02 15:33:20 UTC 1,695 bytes, 58 lines download raw bytes

1(function () {
2  const hostname = window.location.hostname;
3
4  // --- Click Tracking ---
5  document.addEventListener('click', function (e) {
6    const el = e.target.closest('a, button, [role="button"]');
7    if (!el) return;
8
9    if (el.tagName === 'A') {
10      try {
11        const url = new URL(el.href, window.location.origin);
12        if (url.hostname !== hostname) return;
13      } catch {
14        return;
15      }
16    }
17
18    const eventData = {
19      link_url: el.href || '',
20      link_text: el.textContent.trim().substring(0, 100),
21      element_type: el.tagName.toLowerCase(),
22      element_id: el.id || undefined,
23      element_classes: el.className || undefined,
24    };
25
26    if (typeof gtag === 'function') {
27      gtag('event', 'internal_click', eventData);
28    }
29  });
30
31  // --- Scroll Depth Tracking (10%-Schritte) ---
32  const scrollThresholds = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
33  const triggeredThresholds = new Set();
34
35  function getScrollPercent() {
36    const docHeight = document.documentElement.scrollHeight - window.innerHeight;
37    if (docHeight <= 0) return 100;
38    return Math.round((window.scrollY / docHeight) * 100);
39  }
40
41  window.addEventListener('scroll', function () {
42    const percent = getScrollPercent();
43
44    for (const threshold of scrollThresholds) {
45      if (percent >= threshold && !triggeredThresholds.has(threshold)) {
46        triggeredThresholds.add(threshold);
47
48        if (typeof gtag === 'function') {
49          gtag('event', 'scroll_depth', {
50            percent_scrolled: threshold,
51            page_path: window.location.pathname,
52            page_title: document.title,
53          });
54        }
55      }
56    }
57  }, { passive: true });
58})();

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.