All Products
Search
Document Center

Mobile Platform as a Service:Custom analysis

Last Updated:Feb 03, 2021

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

  1. <!-- API-DEMO page/API/report-analytics/report-analytics.axml-->
  2. <view class="page">
  3. <view class="page-description">API for custom analysis</view>
  4. <view class="page-section">
  5. <view class="page-section-title">my.reportAnalytics</view>
  6. <view class="page-section-demo">
  7. <view class="report" onTap="reportAnalytics">Custom analysis</view>
  8. </view>
  9. </view>
  10. </view>
  1. // API-DEMO page/API/report-analytics/report-analytics.js
  2. Page({
  3. reportAnalytics() {
  4. my.reportAnalytics('demo_click', {});
  5. my.alert({
  6. content: 'Data is successfully reported, please go to the Mini Program Management Backend > Data Analysis to view the data',
  7. });
  8. },
  9. });
  1. /* API-DEMO page/API/report-analytics/report-analytics.acss */
  2. .report {
  3. width: 100%;
  4. background: #108ee9;
  5. color: #fff;
  6. border: 1px solid #108ee9;
  7. height: 47px;
  8. line-height: 47px;
  9. border-radius: 5px;
  10. text-align: center;
  11. font-size: 18px;
  12. }