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.

Reference

Type

  1. (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

  1. Taro.reportAnalytics('purchase', {
  2. price: 120,
  3. color: 'red'
  4. })

API Support

API WeChat Mini-Program H5 React Native
Taro.reportAnalytics ✔️