API Reference
中文

Web&H5

Initializing the SDK

Embed the following code in the head TAB of the business-critical entry page

(function () {
  var fm = document.createElement('script');
  fm.type = 'text/javascript';
  fm.async = true;
  fm.src = 'Base URL' + '?t=' + 
  + (new Date().getTime()/3600000).toFixed(0);
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(fm, s);
}())

Base URL

  1. Create Base URL

  1. Copy Base URL

Initialize the configuration parameters

parametertypedescriberemark
channelString''Channel identification
timeoutInteger10000Collection timeout time (unit: ms)
geolocationBooleanfalseEnable geographical location collection

Get device information

Meaning
Gets the device information, which is used to return the specified device information data and the error message when the exception is made. Method definition

window.__fpjs_td && window.__fpjs_td 
.load({})
.then(function (fp){return fp.getDeviceInfo()})
.then(function (result) {
  if(result.apiStatus.code === 0) {
    var anonymousId = result.anonymousId;
    var blackBox = result.blackBox; 
    var fpVersion = result.fmVersion;
    var deviceRiskScore = result.deviceRiskScore;
    var sealedResult = result.sealedResult; 
    var code = result.apiStatus.code; 
    var message = result.apiStatus.message;
  } else {
    var code = result.apiStatus.code;
    var message = result.apiStatus.message;
  }
})

Response result

getDeviceInfo() return the response data, which contains the following information.sealedResult information only when enabledClient sealing result.

FieldDescription
anonymousIdDevice anonymous ID, device identifier
blackBoxEquipment information query identifier
fpVersionSDK version
deviceRiskScoreCurrent equipment risk score
sealedResultThe encrypted device information, a binary Base64 encoded string, is only returned when the client's sealed result is enabled. The decryption result is consistent with the information obtained from the device information query. reference:Device call log

Definition of status information

Based on the information obtained from the SDK, return the corresponding status code.

CodeMessageRemark
0SuccessSuccess
1001SDK errorAn exception occurred in the SDK.
1002Network errorNetwork error
1003API errorThe server interface returns an error
1004Traffic limitGateway rate limiting
1100Unknown errorUnknown error