All Products
Search
Document Center

Mobile Platform as a Service:Event tracking

Last Updated:Mar 10, 2023

The interface is the most primitive event tracking interface that can be used by the front end.

Use remoteLog interface

AlipayJSBridge.call('remoteLog', {
  bizType: "Nebula",    // Business type
  logLevel: 1,          // 1 - high, 2 - medium, 3 - low
  actionId: "event",    // Event tracking type, fixed to "event"
  seedId: "Login",      // Unique identifier of event tracking
  param1: "",
  param2: "",
  param3: "",
  param4:  {key1:"value1",key2:"value2"}, // Custom parameter
});
Note
  • If you need to add a custom buried point parameter, you can add it to the param4 of the above code in the format of key:"value", such as: key1:"value1".

  • When adding multiple custom buried point parameters, the format of the content added in param4 is as follows: param4: "key1:"value1",key2:"value2",key3:"value3".

Code example

<h1>Clicking on the button records the relevant information</h1>

<a href="javascript:void(0)" class="btn read">Click</a>

<script>
function ready(callback) {
  // Call directly if JSBridge has been injected
  if (window.AlipayJSBridge) {
    callback && callback();
  } else {
    // Monitor the injected events if JSBridge hasn't been injected
    document.addEventListener('AlipayJSBridgeReady', callback, false);
  }
}
ready(function() {
  document.querySelector('.read').addEventListener('click', function() {
    AlipayJSBridge.call('remoteLog', {
      type: "behavior",
      bizType: "Nebula",
      spmId: "a1.b2",
      logLevel: 1, // 1 - high, 2 - medium, 3 - low
      actionId: "event"
      seedId: "xxx",
      param1: "xxx",
      param2: "xxx",
      param3: "xxx",
      param4: "xxx",
    });
  });
});
</script>

API

AlipayJSBridge.call('remoteLog', {
  type, seedId, ucId, bizType, logLevel,
  actionId, spmId, param1, param2, param3, param4
});

Input parameters

Name

Type

Description

Required

Default value

type

String

Type of event tracking: monitor (monitoring type), monitorWithLocation (monitoring type, automatically attached with latitude and longitude in param4), behavior (behavior type), behaviorAuto (automatic behavior type), performance (performance type), error (exception type, supported since version 9.6.8), 135 (135 related service, supported since version 9.9).

N

“monitor”

seedId

String

Event tracking ID

Y

“”

ucId

String

Use case ID

N

“”

bizType

float

Business type identifier; when the value is passed by the parameter, a separate log file is generated.

N

“”

logLevel

int

1-high, 2-medium, 3-low; low level logs may be subject to traffic limitation.

N

“”

actionId

String

Event tracking type, fixed to “event”.

Y

“”

spmId

String

SPM encoding. Ignore seedId when spmId is programmed.

Y

“”

param1

String

Event tracking parameter 1

N

“”

param2

String

Event tracking parameter 2

N

“”

param3

String

Event tracking parameter 3

N

“”

param4

String

Event tracking parameter 4

N

“”