my.reportAnalytics
Note: This interface is only supported in mPaaS 10.1.32 and later versions.
Customize reporting interface for analytics data. Before using, you need to create a new event in the event management of the MINI Management Platform and configure the event name and field.
Report customized analysis data. Before using the interface, you should:
- Create events on the Mobile Analysis > Custom Analysis > Custom configuration page in the mPaaS console, and configure the corresponding attributes. For more information, see Configure custom analysis.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| eventName | String | Yes | Custom event name |
| data | Object | Yes | Data reported |
Attributes of data
data is of Object type, with the following attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| key | String | Yes | The field name in the API configuration |
| value | Any | Yes | Data to be reported |
Code example
<!-- API-DEMO page/API/report-analytics/report-analytics.axml--><view class="page"><view class="page-description">API for custom analysis</view><view class="page-section"><view class="page-section-title">my.reportAnalytics</view><view class="page-section-demo"><view class="report" onTap="reportAnalytics">Custom analysis</view></view></view></view>
// API-DEMO page/API/report-analytics/report-analytics.jsPage({reportAnalytics() {my.reportAnalytics('demo_click', {});my.alert({content: 'Data is successfully reported, please go to the Mini Program Management Backend > Data Analysis to view the data',});},});
/* API-DEMO page/API/report-analytics/report-analytics.acss */.report {width: 100%;background: #108ee9;color: #fff;border: 1px solid #108ee9;height: 47px;line-height: 47px;border-radius: 5px;text-align: center;font-size: 18px;}