PageSourceSearch

https://resources.better.org.uk/assets/gll_component_library/contr…/navigation_controller-58111ba5.js

js better.org.uk collected 2026-10-01 10:36:35 UTC 511 bytes, 20 lines download raw bytes

1// app/javascript/controllers/data-layer/navigation_controller.js
2import { Controller } from "@hotwired/stimulus"
3
4export default class extends Controller {
5  connect() {
6    window.dataLayer = window.dataLayer || [];
7  }
8
9  track(event) {
10    const { format, layer, text, url } = event.currentTarget.dataset;
11
12    dataLayer.push({
13      "event": "navigation_click",
14      "navigation_format": format || "desktop",
15      "navigation_layer": layer,
16      "click_text": text,
17      "click_url": url
18    });
19  }
20}

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.