Javascript
Add Verisoul's script onto your site with your
project_id
and env
<head>
<script src="https://js.{env}.verisoul.xyz/bundle.js" verisoul-project-id="{project_id}"></script>
</head>
Environment type strings: prod and sandbox
You can use async or defer script tags, or put the tag in the body to decrease page load times. If you do use these methods make sure the Verisoul object is initialized before calling onAuth calling getTrackingId
Use the ZeroFake SDK to pass a
tracking_id
from the client to your secure server. Then link your internal account identifier and tracking_id
to receive a prediction. ZeroFake generates a
tracking_id
to identify each unique user session. The ID is useful when you want to query for a real time risk prediction and tie an auth_id
to a session. Your application can use getTrackingId()
to get the ID and send it to your secure server. The
getTrackingId()
function returns a promise. The promise is resolved once ZeroFake successfully receives all the session data. The getTrackingId()
will reject or fail in all other cases. As an example of how to integrate:const login = async () => {
try {
const tracking_id = await Verisoul.getTrackingId();
await fetch("https://myapi.com/risk-check", {
method: 'POST',
headers: {'Content-Type': 'application/json' },
body: JSON.stringify({tracking_id}),
});
} catch (e) {
console.log("Verisoul failed to initialized successfully.");
}
}
ZeroFake allows for a
tracking_id
to be tied to exactly one auth_id
. To avoid problems joining a session to an auth_id
be sure to reinitialize once an account has logged out. Calling Verisoul.reinitialize()
ensures that if a user continues the session and logs in with a different account Verisoul will be able to delineate each account's data appropriately. Note: ZeroFake is automatically reinitialized on each page load
const logout = async () => {
try {
await Verisoul.reinitialize();
} catch (e) {
console.log("Verisoul failed to reinitialize");
}
}
ZeroFake allows the ability to send a custom event with your ecosystem specific data. This is helpful to better understand the "context" of a prediction. The information provided can also be integrated into the final ZeroFake score as well. Some potential use cases could be
- A survey company that wants to indicate when a session started and ended a survey
- A game that wants to indicate if the user completed a challenge
To send a custom event you'll need a previously agreed upon
eventName
and an optional event object. Verisoul.customEvent('some_critical_app_step', {optional: 'data'});
Last modified 9d ago