> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# SDK Types: Analytics

**Publié le** : 2026-08-20
**Catégorie** : Types

# SDK Types: Analytics

> **Related services:** **AnalyticsService** — `lynkow.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*

Payload accepted by AnalyticsService.trackEvent. `type` is the
only required field; every other key becomes an ad-hoc property on the
event recorded by the tracker.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `type` | `string` | No | Short slug identifying the event (e.g. `'cta_click'`,<br>`'signup_complete'`). Prefer snake_case so events group cleanly in<br>the analytics dashboard. Required and must be non-empty. |


---

## `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*

Payload accepted by AnalyticsService.trackPageview. Every field
is optional; unset values fall back to the browser context at call time.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `path` | `string` | Yes | URL path to record. Should start with `/`. Query string and hash are<br>preserved as-is; strip them when they do not identify a distinct<br>pageview (e.g. tracker-specific UTM parameters). Defaults to<br>`window.location.pathname` when omitted. |
| `referrer` | `string` | Yes | Referring URL for this pageview, typically `document.referrer`.<br>Pass `''` to record "direct" traffic when you want to override the<br>browser's value. Omit to let the tracker fill it from<br>`document.referrer`. |
| `title` | `string` | Yes | Human-readable page title as it appears in the browser tab, used for<br>the analytics dashboard listing. Defaults to `document.title` when<br>omitted. Max ~255 characters before server-side truncation. |