Skip to content

Configuration

All options go on Moderok.init(config). Requires the storage permission (Manifest & permissions).

OptionTypeDefaultWhat it does
appKeystringrequiredYour Moderok app key (mk_ + at least 16 alphanumeric characters).
endpointstringhttps://api.moderok.dev/v1/eventsWhere event batches are sent. Override only if directed.
flushIntervalnumber30000Milliseconds between automatic sends. Use 0 to disable the interval (you can still flush when the batch is full or call flush()).
batchSizenumber20Events per request (clamped between 1 and 1000).
debugbooleanfalseVerbose logging to the console ([moderok] prefix).
trackUninstallsbooleanfalseSets an uninstall URL via chrome.runtime.setUninstallURL. See Uninstall tracking.
uninstallUrlstring-Optional URL for post-uninstall redirect when uninstall tracking is on.
trackErrorsbooleantrueGlobal uncaught / unhandled rejection capture as __error. Set false to disable.
captureConsoleErrorsbooleanfalseAlso send console.error output as __error (noisy; off by default). Requires trackErrors: true.

Limits (practical)

LimitValue
In-memory queue1000 events (oldest dropped if exceeded)
Persisted pending events500 (oldest dropped when saving)
Single event JSON size8 KiB (oversized events skipped; warning if debug is on)
Uninstall URL (Chrome)1023 characters max
Automatic error burst20 captured errors per minute per JS context

Storage uses the key __moderok__ in chrome.storage.local.

Advanced exports

You normally do not need these:

ExportUse
sanitizePropertiesNormalize or test property stripping.
normalizeConfigResolve defaults the same way the SDK does.
buildUninstallUrlBuild the uninstall ping URL (when customizing tooling).
utcDateStampUTC YYYY-MM-DD string used for daily ping logic.

Moderok: analytics for browser extensions