Mediquo documentation home

API Reference

Full type and method reference for @mediquo/telemetry.

MediquoTelemetryClient

The main client class. Instantiate once per application.

import { MediquoTelemetryClient } from "@mediquo/telemetry";

const telemetry = new MediquoTelemetryClient();

Methods

setApiKey(key: string): void

Initializes the HTTP transport with the given API key. Must be called before any track() call.

telemetry.setApiKey("your-api-key");

track(event: TelemetryEvent): void

Sends an event. Fire-and-forget — delivery errors are suppressed and do not throw.

telemetry.track({
  action_type: "pageview",
  event_type: "screen_viewed",
  screen: "appointment_list",
});

Types

TelemetryEvent

The payload passed to track().

type TelemetryEvent = {
  action_type: TelemetryEventActionType;
  event_type: string;
  [key: string]: unknown;
};
FieldTypeDescription
action_typeTelemetryEventActionTypeClassifies the event. See values below.
event_typestringIdentifier for the specific event (e.g. "appointment_booked").
...restunknownAny additional properties are forwarded as-is to the tracking endpoint.

TelemetryEventActionType

type TelemetryEventActionType = "event" | "pageview" | "debug";
ValueDescription
"event"User-initiated action
"pageview"Route or screen change
"debug"Development-only diagnostic