Related services: AnalyticsServicelynkow.analytics.destroy(), lynkow.analytics.disable(), lynkow.analytics.enable(), lynkow.analytics.getTracker(), lynkow.analytics.init(), lynkow.analytics.isEnabled(), lynkow.analytics.isInitialized(), lynkow.analytics.trackEvent(), lynkow.analytics.trackPageview()

EventData

Interface

Data for tracking custom events

Property

Type

Optional

Description

type

string

No

Event type


EventName

TypeAlias

TypeScript
type EventName = keyof LynkowEvents

LynkowEvents

Interface

Event types emitted by the SDK. Each key is an event name; the value type is the payload passed to listeners. Use void payload events with emit(event, undefined as any).

Property

Type

Optional

Description

consent-changed

Record<string, boolean>

No

Emitted when the user updates their cookie consent preferences.<br>Payload is a map of category ID to consent boolean<br>(e.g. { necessary: true, analytics: false, marketing: false }).<br>Use this to inject or remove third-party scripts based on consent.

error

Error

No

Emitted when an SDK operation encounters an unrecoverable error.<br>Payload is the Error (typically a LynkowError) that occurred.<br>Use this for global error logging or displaying error notifications.

locale-changed

string

No

Emitted when the active locale changes (e.g. via user action or detection).<br>Payload is the new locale code (e.g. 'fr', 'en').<br>Use this to re-fetch locale-dependent data (contents, categories, pages).

ready

void

No

Emitted once when the SDK client is fully initialized and ready to make requests.<br>No payload. Subscribe before calling any service methods to ensure readiness.


PageviewData

Interface

Data for tracking pageviews

Property

Type

Optional

Description

path

string

Yes

Page path (default: window.location.pathname)

referrer

string

Yes

Referrer URL

title

string

Yes

Page title (default: document.title)