Javascript Behaviour Overview
The Behaviour Analysis API enables the collection and evaluation of user interaction patterns such as mouse movements, touch events, keystrokes, and navigation behavior. This data is securely collected, encrypted, and transmitted to the Sense Server, where it is analyzed to distinguish human behavior from automated or fraudulent activity, enhancing security, fraud detection, and risk assessment in real time.
This guide explains the integration process for:
- JavaScript SDK (Web)
Each SDK securely collects environment data and transmits it to your backend for processing via the Sense API.
Integration
PRODUCTION https://strctl.gosense.ai/api/v1
1. JS SDK Integration
// Call the function to get the encrypted payload
//Import the Behaviour file
<script type="text/javascript" src="https://cdn.gosense.ai/js/v1/sense-behaviour"></script>
//Initiate
<script>
Behaviour.init({
api_key : 'sensepk__xxxxxxxxxxx',
reference_id : 'USER000123' //Sense ID or reference id
});
</script>
Sample Program
Here you can find the demonstration to do the integration.
Code
// Call the function to get the encrypted payload
<script>
// When the Sense package listens to user behavior, calling this function starts the behavior tracking.
Behaviour.startTracking();
// Calling this function stops listening to user behavior and ends the behavior tracking.
Behaviour.stopTracking()
// Calling this function retrieves the collected user behavior details.
Behaviour.getTrackingDetails().then((response) => {
console.log(response);
}).catch(e => {
console.log(e);
})
</script>