PageSourceSearch

https://railsblocks.com/assets/controllers/page_view_controller-f3…eb2a19fd78b0657d234018629d2e5eb06fd5e36d.js

js railsblocks.com collected 2026-09-25 20:23:50 UTC 923 bytes, 37 lines download raw bytes

1import { Controller } from "@hotwired/stimulus";
2
3export default class extends Controller {
4  static values = {
5    eventName: String,
6    eventValue: Number,
7    // Additional properties for PostHog
8    properties: Object,
9  };
10
11  connect() {
12    // Track the page view event
13    if (this.hasEventNameValue) {
14      // Track with Fathom
15      if (typeof fathom !== "undefined") {
16        const eventOptions = {};
17
18        if (this.hasEventValueValue) {
19          eventOptions._value = this.eventValueValue;
20        }
21
22        fathom.trackEvent(this.eventNameValue, eventOptions);
23      }
24
25      // Track with PostHog
26      if (typeof posthog !== "undefined") {
27        const properties = this.hasPropertiesValue ? this.propertiesValue : {};
28
29        if (this.hasEventValueValue) {
30          properties.value = this.eventValueValue;
31        }
32
33        posthog.capture(this.eventNameValue, properties);
34      }
35    }
36  }
37};

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.