mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
Bulk rename across 989 files: - Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc. - Repository URLs: posthog/posthog-js → hanzoai/insights-js - Brand names: PostHog → Insights - File renames: 259 reference JSON files, source files, workflow files - Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
131 lines
5.1 KiB
HTML
131 lines
5.1 KiB
HTML
<html>
|
|
<head>
|
|
<title>Insights JS Snippet test</title>
|
|
<!-- Below can be enabled to test with a Consent Management Platform (CMP) like Osano that often causes infinite loop errors -->
|
|
<!-- <script src="https://cmp.osano.com/16CPMUTPznTQbEG/88c966c1-72a5-40ca-90b3-274dd5cbff70/osano.js"></script> -->
|
|
</head>
|
|
<body>
|
|
<button data-cy-button>Some button</button>
|
|
|
|
<br />
|
|
|
|
<input data-cy-input placeholder="Input" />
|
|
|
|
<br />
|
|
|
|
<button data-cy-custom-event-button onclick="insights.capture('custom-event', { foo: 2 })">
|
|
Send custom event
|
|
</button>
|
|
|
|
<br />
|
|
|
|
<button data-cy-feature-flag-button onclick="console.log(insights.isFeatureEnabled('some-feature'))">
|
|
Test a feature flag
|
|
</button>
|
|
|
|
<br />
|
|
|
|
<div data-cy-captures></div>
|
|
|
|
<a data-cy-link-mask-text> Sensitive text! </a>
|
|
|
|
<!-- TODO: Remove the ="true" once we have fixed the bug with autocapture to ensure E2E that it works -->
|
|
<button data-cy-button-sensitive-attributes="true" class="sensitive" id="sensitive" data-sensitive="sensitive">
|
|
Sensitive attributes!
|
|
</button>
|
|
|
|
<div>
|
|
<div>
|
|
SessionID:
|
|
<span id="current-session-id"></span>
|
|
</div>
|
|
<div>
|
|
WindowID:
|
|
<span id="current-window-id"></span>
|
|
</div>
|
|
|
|
<button data-cy-open-new-window onclick="window.open(window.location)">Open new window</button>
|
|
</div>
|
|
|
|
<button onclick="insights.startSessionRecording();">Start recording</button>
|
|
|
|
<script>
|
|
!(function (t, e) {
|
|
var o, n, p, r
|
|
e.__SV ||
|
|
((window.insights = e),
|
|
(e._i = []),
|
|
(e.init = function (i, s, a) {
|
|
function g(t, e) {
|
|
var o = e.split('.')
|
|
2 == o.length && ((t = t[o[0]]), (e = o[1])),
|
|
(t[e] = function () {
|
|
t.push([e].concat(Array.prototype.slice.call(arguments, 0)))
|
|
})
|
|
}
|
|
;((p = t.createElement('script')).type = 'text/javascript'),
|
|
(p.crossOrigin = 'anonymous'),
|
|
(p.async = !0),
|
|
(p.src = 'http://localhost:3001' + '/static/array.full.js'),
|
|
(r = t.getElementsByTagName('script')[0]).parentNode.insertBefore(p, r)
|
|
var u = e
|
|
for (
|
|
void 0 !== a ? (u = e[a] = []) : (a = 'insights'),
|
|
u.people = u.people || [],
|
|
u.toString = function (t) {
|
|
var e = 'insights'
|
|
return 'insights' !== a && (e += '.' + a), t || (e += ' (stub)'), e
|
|
},
|
|
u.people.toString = function () {
|
|
return u.toString(1) + '.people (stub)'
|
|
},
|
|
o =
|
|
'capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags'.split(
|
|
' '
|
|
),
|
|
n = 0;
|
|
n < o.length;
|
|
n++
|
|
)
|
|
g(u, o[n])
|
|
e._i.push([i, s, a])
|
|
}),
|
|
(e.__SV = 1))
|
|
})(document, window.insights || [])
|
|
</script>
|
|
|
|
<script>
|
|
insights.init('phc_gV2VtAdq8G5nA3bAJSPZDYafV5FxvPxw8DcXMHgotmT', {
|
|
api_host: 'http://localhost:8000',
|
|
disable_session_recording: true,
|
|
capture_performance: true,
|
|
capture_pageview: 'history_change',
|
|
})
|
|
|
|
insights.init(
|
|
'phc_other',
|
|
{
|
|
api_host: 'http://localhost:8000',
|
|
disable_session_recording: true,
|
|
capture_performance: true,
|
|
capture_pageview: 'history_change',
|
|
},
|
|
'other'
|
|
)
|
|
|
|
insights.capture('event')
|
|
insights.capture('event2')
|
|
insights.people.set({ test: true })
|
|
insights.other.capture('other_event')
|
|
insights.other.people.set({ test: true })
|
|
console.log(insights)
|
|
|
|
setTimeout(() => {
|
|
insights.debug()
|
|
document.getElementById('current-session-id').innerHTML = insights.sessionRecording.sessionId
|
|
document.getElementById('current-window-id').innerHTML = insights.sessionRecording.windowId
|
|
}, 100)
|
|
</script>
|
|
</body>
|
|
</html>
|