Analytics
The Analytics API provides event tracking and analytics.
Try it online
Event name eventId
params (optional JSON)
Quick presets
Import
ts
import woo from 'mini-sdk'
// 或
import { analytics } from 'mini-sdk'API reference
enableAutoAnalytics
Enable automatic analytics (page views, clicks, etc.).
ts
await woo.enableAutoAnalytics()recordEvent
Track a custom event.
ts
woo.recordEvent(options: RecordEventOptions): Promise<void>Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
eventId | string | Yes | Event identifier |
params | Record<string, unknown> | No | Event parameters |
ts
// Track a button click
await woo.recordEvent({
eventId: 'button_click',
params: {
buttonName: 'submit',
page: 'checkout',
},
})
// Track a purchase
await woo.recordEvent({
eventId: 'purchase',
params: {
productId: 'SKU001',
amount: 99.99,
currency: 'CNY',
},
})enableNotification / disableNotification
Enable or disable push notifications.
ts
await woo.enableNotification()
await woo.disableNotification()Type definitions
ts
interface RecordEventOptions {
eventId: string
params?: Record<string, unknown>
}Quick reference
| Method | Description | Signature |
|---|---|---|
reportAnalytics | Track a custom event | ({ eventId, params? }) → void |
reportMonitor | Report performance monitor data | ({ name, value }) → void |