Configuration
All options go on Moderok.init(config). Requires the storage permission (Manifest & permissions).
| Option | Type | Default | What it does |
|---|---|---|---|
appKey | string | required | Your Moderok app key (mk_ + at least 16 alphanumeric characters). |
endpoint | string | https://api.moderok.dev/v1/events | Where event batches are sent. Override only if directed. |
flushInterval | number | 30000 | Milliseconds between automatic sends. Use 0 to disable the interval (you can still flush when the batch is full or call flush()). |
batchSize | number | 20 | Events per request (clamped between 1 and 1000). |
debug | boolean | false | Verbose logging to the console ([moderok] prefix). |
trackUninstalls | boolean | false | Sets an uninstall URL via chrome.runtime.setUninstallURL. See Uninstall tracking. |
uninstallUrl | string | - | Optional URL for post-uninstall redirect when uninstall tracking is on. |
trackErrors | boolean | true | Global uncaught / unhandled rejection capture as __error. Set false to disable. |
captureConsoleErrors | boolean | false | Also send console.error output as __error (noisy; off by default). Requires trackErrors: true. |
Limits (practical)
| Limit | Value |
|---|---|
| In-memory queue | 1000 events (oldest dropped if exceeded) |
| Persisted pending events | 500 (oldest dropped when saving) |
| Single event JSON size | 8 KiB (oversized events skipped; warning if debug is on) |
| Uninstall URL (Chrome) | 1023 characters max |
| Automatic error burst | 20 captured errors per minute per JS context |
Storage uses the key __moderok__ in chrome.storage.local.
Advanced exports
You normally do not need these:
| Export | Use |
|---|---|
sanitizeProperties | Normalize or test property stripping. |
normalizeConfig | Resolve defaults the same way the SDK does. |
buildUninstallUrl | Build the uninstall ping URL (when customizing tooling). |
utcDateStamp | UTC YYYY-MM-DD string used for daily ping logic. |