PageSourceSearch

https://bepodcast.network/wp-content/plugins/kantan-analytics/assets/js/form-fields.js?ver=2.31.1

js bepodcast.network collected 2026-09-24 19:47:53 UTC 1,351 bytes, 43 lines download raw bytes

1/**
2 * Kantan Analytics — form session field injector.
3 *
4 * Adds hidden kantan_session_id / kantan_visitor_id inputs to every form on the
5 * page so form-plugin submissions can be attributed to the visitor's session.
6 * IDs come from the tracking script's sessionStorage/localStorage; if neither is
7 * present (e.g. logged-in admins, who aren't tracked) the script no-ops.
8 */
9(function () {
10	function injectFields(form, name, value) {
11		if (!value || form.querySelector('input[name="' + name + '"]')) {
12			return;
13		}
14		var input = document.createElement('input');
15		input.type = 'hidden';
16		input.name = name;
17		input.value = value;
18		form.appendChild(input);
19	}
20
21	function injectSessionFields() {
22		var sessionId = sessionStorage.getItem('kantan_session_id');
23		var visitorId = localStorage.getItem('kantan_visitor_id');
24		if (!sessionId && !visitorId) {
25			return;
26		}
27
28		var forms = document.querySelectorAll('form');
29		for (var i = 0; i < forms.length; i++) {
30			injectFields(forms[i], 'kantan_session_id', sessionId);
31			injectFields(forms[i], 'kantan_visitor_id', visitorId);
32		}
33	}
34
35	if (document.readyState === 'loading') {
36		document.addEventListener('DOMContentLoaded', injectSessionFields);
37	} else {
38		injectSessionFields();
39	}
40
41	// Re-inject every 2 seconds to catch AJAX-loaded forms.
42	setInterval(injectSessionFields, 2000);
43})();

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.