PageSourceSearch

https://www.unomaha.edu/registrar/students/before-you-enroll/class-search/class-search-analytics-tracking.js

js unomaha.edu collected 2026-09-24 08:29:11 UTC 1,789 bytes, 66 lines download raw bytes

1(function () {
2
3  const form = document.getElementById("class-search");
4  if (!form || !window.dataLayer) return;
5
6  // ---- FIELD USAGE TRACKING ----
7  const usedFieldsSet = new Set(); // to prevent duplicates
8
9  form.querySelectorAll('input, select').forEach(field => {
10
11    field.addEventListener('change', function () {
12
13      let isUsed = false;
14
15      if (field.type === 'checkbox' || field.type === 'radio') {
16        isUsed = field.checked;
17      } else if (field.tagName.toLowerCase() === 'select') {
18        isUsed = field.value && field.value.trim() !== '';
19      } else {
20        isUsed = field.value && field.value.trim() !== '';
21      }
22
23      if (!isUsed) return; // skip if not actually used
24      if (usedFieldsSet.has(field.name)) return; // prevent duplicate tracking
25
26      usedFieldsSet.add(field.name);
27
28      dataLayer.push({
29        event: 'class_search_field_used',
30        field_name: field.name
31      });
32
33    });
34
35  });
36
37  // ---- SEARCH SUBMIT TRACKING ----
38  form.addEventListener('submit', function () {
39
40    const usedFieldsArray = [];
41
42    form.querySelectorAll('input, select').forEach(field => {
43      if (!field.name) return;
44
45      let isUsed = false;
46
47      if (field.type === 'checkbox' || field.type === 'radio') {
48        isUsed = field.checked;
49      } else if (field.tagName.toLowerCase() === 'select') {
50        isUsed = field.value && field.value.trim() !== '';
51      } else {
52        isUsed = field.value && field.value.trim() !== '';
53      }
54
55      if (isUsed) usedFieldsArray.push(field.name);
56    });
57
58    window.dataLayer.push({
59      event: 'class_search_submit',
60      fields_used: usedFieldsArray.join(','),
61      field_count: usedFieldsArray.length
62    });
63
64  });
65
66})();

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.