35 lines
1.7 KiB
TypeScript
35 lines
1.7 KiB
TypeScript
// Runs in the browser before the app. On the platform the page's own origin is
|
|
// the collector, so no configuration is needed here.
|
|
//
|
|
// Replay mode 'always' (showcase plan D22): the SDK's default ('onError') only uploads a
|
|
// replay when an error is captured or replay.flush() is called, so a plain showcase visit
|
|
// with no error produces nothing to show on Analytics > Session Replays. 'always' streams
|
|
// from page start regardless of errors, so every visit is recorded.
|
|
//
|
|
// consent: 'opt-out' (showcase plan D24): replay (like identify) is a 'consented' item
|
|
// (@conusai-sdk/observe's core/consent.ts verdict()), and the default consent mode,
|
|
// 'anonymous', never sends consented items — mode: 'always' alone does not start the
|
|
// recorder at all, because canRecord() gates on core.permits('consented'). The showcase
|
|
// has no consent banner (plan D16: no user auth), so 'opt-out' starts the session granted;
|
|
// GPC/DNT still revokes it (respectGPC defaults to true).
|
|
//
|
|
// Every module explicit, on purpose (showcase plan D25): @conusai-sdk/observe
|
|
// enables only `errors` by default — analytics, vitals, traces, replay and logs
|
|
// are each off unless named under `modules`. A showcase that forgot one would
|
|
// show nothing on that console page after a real visit (first seen 2026-10-11,
|
|
// stage: Analytics read 0 visitors/0 sessions and Observe read "Traces off"/
|
|
// "Audit off" because only replay was enabled). test/instrumentation-client.test.ts
|
|
// fails if any of the five is left off or set to a bare `false`.
|
|
import { instrumentationClient } from '@conusai-sdk/observe-next'
|
|
|
|
instrumentationClient({
|
|
consent: 'opt-out',
|
|
modules: {
|
|
analytics: true,
|
|
vitals: true,
|
|
traces: true,
|
|
replay: { mode: 'always' },
|
|
logs: true,
|
|
},
|
|
})
|