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
- Create Base URL

- Copy Base URL

Initialize the configuration parameters
parameter | type | describe | remark |
---|---|---|---|
channel | String | '' | Channel identification |
timeout | Integer | 10000 | Collection timeout time (unit: ms) |
geolocation | Boolean | false | Enable 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.
Field | Description |
---|---|
anonymousId | Device anonymous ID, device identifier |
blackBox | Equipment information query identifier |
fpVersion | SDK version |
deviceRiskScore | Current equipment risk score |
sealedResult | The 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.
Code | Message | Remark |
---|---|---|
0 | Success | Success |
1001 | SDK error | An exception occurred in the SDK. |
1002 | Network error | Network error |
1003 | API error | The server interface returns an error |
1004 | Traffic limit | Gateway rate limiting |
1100 | Unknown error | Unknown error |