Initializing the SDK
Embed the following code in the head TAB of the business-critical entry page
<script type="text/javascript">
(function(){
window._fmOpt = {
partner: 'your partner',
success: function(data) {
console.log('blackbox: ', data)
}
};
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);
})();
</script>
Base URL
1.Create Base URL
2.Copy Base URL
window._fmOpt Parameter Description
parameter | type | describe | remark | sample | required | Remove Field |
---|---|---|---|---|---|---|
partner | String | Name of partner | Do not change at will (only letters, numbers, underscores) | demo | Yes | |
channel | String | channel | Do not change at will (only letters, numbers, underscores) | demo_web | No | |
success | Function | Successful callback | Once the blackbox is successfully fetched, the incoming callback is called | function(data){ console.log('blackbox:',data) } | Yes | |
timeout | Integer | Collection timeout | The unit is ms. The default value is 2000. If all processes are not completed after the specified time, a demoted blackbox is obtained | 2000 | No | |
strictMode | Boolean | Strict mode | true: The current demoted blackbox is returned when demoted false: Returns the cached last non-demoted blackbox (default) when demoted | false | No | |
geolocation | Boolean | Enable geolocation collection | true: Enable false: Disable (default) | false | No | latitude、longitude |
Get SDK Version
Obtain by source code file
/**
* TrustDeviceJs Pro v3.8.11 - Copyright (c) TrustDeviceJs, Inc, 2024 (https://www.trustdecision.com/solutions/trustdevice)
*/
Obtain by code in runtime
window._fmOpt.sdkVersion