title: Taro.reportAnalytics(eventName, data)
sidebar_label: reportAnalytics
Reports custom analysis data. Before using this API, you need to create an event in Custom Analysis on the Mini Program admin console, and configure the event name and fields.
Type
(eventName: string, data: Record<string, any>) => void
Parameters
| Property | Type | Description |
|---|---|---|
| eventName | string |
The event name. |
| data | Record<string, any> |
The reported custom analysis data. |
Sample Code
Taro.reportAnalytics('purchase', {price: 120,color: 'red'})
API Support
| API | WeChat Mini-Program | H5 | React Native |
|---|---|---|---|
| Taro.reportAnalytics | ✔️ |
