PageSourceSearch

https://www.fatturaelettronica-app.it/assets/js/custom/posthog-events.js?v=6

js fatturaelettronica-app.it collected 2026-09-24 09:27:57 UTC 2,500 bytes, 87 lines download raw bytes

1/* global posthog */
2
3/*
4data-ph-event-name="nome_evento"
5data-ph-on="click|submit"           (click è il default)
6data-ph-prop-nome-campo="valore"
7data-ph-send-immediately="true"     (solo per azioni che navigano/submittano)
8*/
9
10(function () {
11  const EVENT_ATTRIBUTE = 'data-ph-event-name';
12  const PROPERTY_PREFIX = 'data-ph-prop-';
13
14  function toCamelCase(value) {
15    return value.replace(/-([a-z])/g, function (_, letter) {
16      return letter.toUpperCase();
17    });
18  }
19
20  function getProperties(element) {
21    const properties = {
22      page_path: window.location.pathname
23    };
24
25    Array.from(element.attributes).forEach(function (attribute) {
26      if (attribute.name.startsWith(PROPERTY_PREFIX)) {
27        const name = attribute.name.slice(PROPERTY_PREFIX.length);
28        properties[toCamelCase(name)] = attribute.value;
29      }
30    });
31
32    return properties;
33  }
34
35  function capture(element) {
36    const eventName = element.getAttribute(EVENT_ATTRIBUTE);
37
38    // posthog is loaded asynchronously and may be blocked by consent/CSP.
39    if (!eventName || typeof window.posthog === 'undefined' ||
40        typeof posthog.capture !== 'function') {
41      return;
42    }
43
44    const options = element.dataset.phSendImmediately === 'true'
45      ? { transport: 'sendBeacon', send_instantly: true }
46      : undefined;
47
48    posthog.capture(eventName, getProperties(element), options);
49    console.log(posthog === window.posthog);
50    console.log("evento catturato:", eventName, getProperties(element), options);
51  }
52
53  function track(event) {
54    const element = event.target.closest('[' + EVENT_ATTRIBUTE + ']');
55
56    if (!element || (element.dataset.phOn || 'click') !== event.type) {
57      return;
58    }
59
60    capture(element);
61  }
62
63  document.addEventListener('click', track);
64  document.addEventListener('submit', track);
65  
66  // Bootstrap gestisce il backdrop dal contenitore del modale:
67  // un click sul backdrop produce target === currentTarget su #attivaGratis.
68  var signupModal = document.getElementById('attivaGratis');
69
70  if (signupModal) {
71    signupModal.addEventListener('click', function (event) {
72      if (event.target !== event.currentTarget ||
73          !signupModal.classList.contains('show')) {
74        return;
75      }
76
77      if (typeof window.posthog === 'undefined' ||
78          typeof posthog.capture !== 'function') {
79        return;
80      }
81
82      posthog.capture('attiva_gratis_modal_closed', {
83        page_path: window.location.pathname
84      });
85    });
86  }
87}());

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.