Kansoku on the intranet
Kansoku is the intranet's shared analytics service. Any app or site deployed to
labs.topagentnetwork.net can record page views and product events with a public
write key; the operator reads the metrics per host with a service token. This page serves the
browser SDK, kansoku.js, and tracks its own page views
with it.
Track your app
- Ask the operator for a write key for your app (see the runbook section
"Track an app with Kansoku" in
tan-ng-labs). A write key can only send events, so it is safe to embed in a page. - Add this to your pages, with your own key and service name:
<script type="module">
import { createKansoku } from "https://kansoku-js.labs.topagentnetwork.net/kansoku.js"
const kansoku = createKansoku({
baseUrl: "https://kansoku.labs.topagentnetwork.net",
writeKey: "ksk_w_…", // your app's write key
sourceService: "your-app", // your Nagare service name
})
kansoku.track("feature_used", { feature: "example" })
</script>
Page views, sessions and page leaves are captured automatically. Backends running on the
cluster post the same events to
http://kansoku.personal.svc.cluster.local/v1/events with the write key in
X-Api-Key. Registered events and their properties are listed at
/v1/schemas.
Live demo
Opening this page recorded a page_view for host
kansoku-js.labs.topagentnetwork.net. The button records a
feature_used event with feature = "demo-ping".
loading the SDK…