Menu

Calculate Event Duration

     Call the createTimerEvent to start timing for an event. Configure the name of the event, and event properties to report. When the event comes to an end, a "_duration" property will automatically be added for this event (unit: millisecond). It should be noted that there can only be one timing task for the same event.

Step 1: Create Duration Event

Function

ppublic synchronized TrackEvent createTimerEvent(String eventName, JSONObject eventData);
ParameterDescriptionTypeRequired
eventNameDeveloper custom event name String Yes
customEventDataDeveloper custom event property JSONObject Yes

Returned value: "trackEvent"

Sample Code

import com.reyun.solar.engine.SolarEngineManager;
import org.json.JSONObject;

JSONObject eventData = new JSONObject();
try {
    //Custom event properties in JSON format.
    eventData.put("key1","value1");
    eventData.put("key2","value2");
  ......
} catch (JSONException e) {
///
}

TrackEvent trackEvent = SolarEngineManager.getInstance().createTimerEvent("xxxCustomEventNamexxx", eventData);

Step 2: Report Duration Event

Function

public synchronized void trackTimerEvent(TrackEvent trackEvent);
ParameterDescriptionTypeRequired
trackEventDeveloper custom duration event name TrackEvent Yes

Sample Code

import com.reyun.solar.engine.SolarEngineManager;

//The trackEvent here is obtained by creating duration event calling createTimerEvent method.

trackEventSolarEngineManager.getInstance().trackTimerEvent(trackEvent);

Note:

       When reporting the preset event _appEnd, the duration starting from the last _appStart will be reported by default. That is, the duration of an exit event does not need to be configured to start timing, and will be assigned a value by default.

Previous
First Time Event
Next
Native App & H5 Connection
Last modified: 2024-12-03Powered by