Data Reporting by Self-Defined Actions

The following two types of data reporting methods are supported, which are:

  • Data Reporting by Pre-Defined APIs
  • Data Reporting by Self-Defined Actions

This topic introduces data reporting by self-defined actions. With this method, you can define the actions with different parameters to collect and report data automatically.

Procedures

To report the data by self-defined actions, complete the following steps:

  1. When defining an event, choose the By Self-Defined Actions Data Reporting Method.
  2. Configure the action with the following parameters:
  • Define the trigger condition.
  • Define the report type. Two report types are supported:
  • Collect and Report Once
  • Collect Multiple Times and Report Once
  • Define the triggered page.
  • Define the triggered element.
  • Save and publish the actions.

Note:

If you choose the Collect Multiple Times and Report Once report type, you must specify that the action is used to collect or report data. After you select the Collect Multiple Times and Report Once report type, you can see the following fields:

  • Start: Start to collect data.
  • Report: Report the collected data.

The last one action must be used to report data.

Trigger conditions

The following trigger conditions are supported:

  • enterPage: Triggered when users open a new page, return to the previous page, or switch to the foreground. Page must be specified.
  • click: Triggered by a click event. Page and element must be specified.
  • leavePage: Triggered when users exit a page or switching to the background. Page must be specified.
  • pageLoad: Triggered when users open a new page for the first time. Page must be specified.
  • pageUnload: Triggered when users reclaim a page. Page must be specified.
  • switchTab: Triggered when calling the my.switchTab API to switch to another page. Page must be specified.
  • pullDownRefresh: Triggered by pull-to-refresh event. Page must be specified.
  • launch: Triggered when users load the mini program.
  • background: Triggered when users switch to the background.
  • foreground: Triggered when users switch to the foreground.
  • share: Triggered when users share the page via the menu in the upper-right corner.

More information

Manage Events

Data Reporting by Pre-Defined APIs