Events & properties
Custom events
Use Moderok.track(eventName, properties?) for anything you want to measure: button clicks, flows completed, settings changed, and so on.
Moderok.track("export_clicked");
Moderok.track("settings_saved", { theme: "dark", notifications: true });Pick stable names you will recognize in the dashboard. snake_case or dot.case both work well — just stick to one style.
Property rules
Properties are optional and must be flat: each value is a string, number, or boolean only.
Note
Nested objects, arrays, null, and invalid numbers are dropped. With debug: true on init(), the SDK logs when something is stripped. See Configuration.
If you need structure, use separate keys (for example item_count instead of an array).
Manual flush (optional)
The SDK flushes on a timer and when batches fill up. You can force a flush if you need events sent immediately:
await Moderok.flush();Most extensions rarely need this.
Check if init ran
if (Moderok.isInitialized()) {
// ...
}true means init() was called in this context (even if background work is still finishing).