Skip to content

PlatformAnalyticsProvider

whisker-host and platform shell apps — one instance at host root.

Individual modules — use ModuleAnalyticsProvider.

For the full three-layer architecture (Platform → Module → Scope → component), OpenTelemetry attribute conventions, merge order, and a worked example of what lands in the analytics backend, see Analytics architecture.

Auto-generated from src/providers/SharedAnalyticsProvider/SharedAnalyticsProvider.types.ts. Do not edit by hand. Run pnpm docs:props after changing source JSDoc.

Prop Type Required Description
adapter AnalyticsAdapter No Optional explicit adapter. When provided, takes precedence over config — use this to plug in a non-default backend (e.g. OtlpAdapter, ConsoleAdapter for tests). When omitted, the provider uses NewRelicAdapter(config) if config is given, otherwise ConsoleAdapter.
children ReactNode Yes Children
config PlatformAnalyticsConfig No Configuration for the default New Relic adapter. Ignored when adapter is supplied. Optional so hosts that don’t use New Relic can rely on ConsoleAdapter or pass their own adapter.
disabled boolean No Disable analytics entirely (skips initialization and gates all events).
globalAttributes Record<string, boolean | null | number | string | undefined> No Platform-level attributes (applied to all events across all modules). These attributes are REACTIVE — when values change, the adapter receives an update. Pass both static and dynamic values here. Prefer OpenTelemetry semantic convention names (e.g. enduser.id, deployment.environment, service.version) so a future OTLP-capable adapter can forward them unchanged. Null/undefined values clear the attribute on the adapter. All modules automatically inherit these attributes.
isProd boolean Yes Whether running in production (passed to the adapter’s initialize).
import { PlatformAnalyticsProvider } from '@nike/whisker-component-library';
<PlatformAnalyticsProvider>
<WhiskerHostShell />
</PlatformAnalyticsProvider>;