Manage events

Events are the basis for event analysis on the Mini Program platform.

This document explains how to manage events throughout their lifecycles, from creation to deletion. This topic outlines the step-by-step processes and permissions required for each action.

Create an event

To create an event, take the following steps:

  1. Log on to the Mini Program platform.
  2. In the left navigation panel, choose Analytics > Custom Analysis.
  3. On the displayed Custom Analysis page, find the desired mini program.
  4. Click Events in the Action column. The Manage Event tab is displayed.
  5. On the Manage Event tab, click New Event.
  6. On the New Event page, configure the parameters:

Parameter

Description

Example value

Event Name

The name of the event.

Follow a clear and consistent naming convention so analysts and developers can recognize it.

event_example1

Data Reporting Method

Specify the method in which data is collected and reported.

By default, By Self-Defined Actions is selected, which specifies that data are reported when the custom actions occur and conditions match.

By Self-Defined Actions

Action 1

Configure the action that triggers the event. An event can contain one or multiple actions. Each action is an independent rule that can trigger the event.

  • Trigger: Select the operation that triggers this action. Options:
    • click
    • enterPage
    • leavePage
    • pageLoad
    • pageUnload
    • switchTab
    • pullDownRefresh
    • launch
    • background
    • foreground
    • share
  • Report Type: Specify how often this action reports data:
    • Collect and Report Once: collects and reports data on a single action of a user.
    • Collect Multiple Times and Report Once: collects data on multiple actions of a user and reports the data once. In this case, you must specify whether to start collecting data or reporting the collected data when the action is triggered:
      • Start: starts to collect data.
      • Report: reports the collected data.

Note: The last action in an event must be reporting data.

  • Page: Enter the page path. You can find the page path via app.json files in the mini program source code of IDE (Mini Program Studio).
  • Element: The UI element to interact for the trigger to fire. Enter a class or ID, which must begin with a period (.) or a number sign (#), respectively. You can find the element via app.json files in mini program source code of IDE (Mini Program Studio).

Note: Page and Element are required only for specific operations.

  • Add fields. Fields are the metrics you want to analyze. You can define a name and assign attributes to this metric via Field Value and Field Type. You can click Field to add more fields.
    • Field Name: the name of a field.
    • Field Value: the value (variable) of the field.
    • Field Type:
      • Int: the integer type. Int is suitable for calculating amounts, where you can further define its maximum, minimum, count, sum, and average.
      • String: the string type. String is suitable for calculating the count of each occurrence.
    • Note: remarks of the field. You can describe fields in detail.

After configuring an action, you can click Action to add more actions to the event.

N/A

  1. After the event is configured, you can click one of the following buttons based on your business requirements:
    • Save: Stores your configuration as a draft.
    • Save & Test: Saves and opens test mode so you can validate that triggers fire as expected, selectors match, fields populate correctly, and Report Type behaves as intended. Use this before publishing.
    • Save & Publish: Publishes the event. Data collection starts immediately for users who meet the action conditions. You can also publish the event after the event is created. For more information, see Publish an event.

View events

After you create an event, you can view the event and the event list in the Manage Event tab. To view events, take the following steps:

  1. Log on to the Mini Program platform.
  2. In the left navigation panel, choose Analytics > Custom Analysis.
  3. On the displayed Custom Analysis page, find the desired mini program.
  4. Click the name of the mini program or Events in the Action column.
  5. In the Manage Event tab, you can view the event list. The list displays information of the events, such as the name, creation time, update time, and status, and the actions you can perform on the events.

image.png

Figure 1. Manage Event

  1. You can click View in the Action of an event to view the details of the event.

image.png

Figure 2. View an event

Modify an event

After you create an event, you can modify the event and the event list in the Manage Event tab. To modify an event, take the following steps:

  1. Log on to the Mini Program platform.
  2. In the left navigation panel, choose Analytics > Custom Analysis.
  3. In the displayed Custom Analysis page, find the desired mini program.
  4. Click the name of the mini program or Events in the Action column.
  5. Click Edit to modify the event.

Note: You can also click View in the Action column and then click Modify in the upper-right corner to open the event modification page.

  1. On the Edit Event page, modify the event based on your business requirements and click Save.

image.png

Figure 3. Modify an event

Note: You can click Revert to Published Version in the Event Status field to compare the event information with the published version and restore the configurations to those of the published version.

Publish an event

You can use an event to perform event analysis only after it is published. You can publish an event when you create the event. This section describes how to publish an event after it is created.

To publish an event, take the following steps:

  1. Log on to the Mini Program platform.
  2. In the left navigation panel, choose Analytics > Custom Analysis.
  3. On the displayed Custom Analysis page, find the desired mini program.
  4. Click the name of the mini program or Events in the Action column.
  5. Click View in the Action column.
  6. On the displayed event information page, click Publish in the upper-right corner.

image.png

Figure 4. Publish an event

  1. In the confirmation dialog, click Publish.

Delete an event

To delete an event, take the following steps:

  1. Log on to the Mini Program platform.
  2. In the left navigation panel, choose Analytics > Custom Analysis.
  3. On the displayed Custom Analysis page, find the desired mini program.
  4. Click the name of the mini program or Events in the Action column.
  5. Click View in the Action column.
  6. On the displayed event information page, click Delete in the upper-right corner.

image.png

Figure 5. Delete an event

  1. In the confirmation dialog, click Delete.

More information