Account Defense - Login
The NeuroID JavaScript Library is customized for your Site Id and hosted on NeuroID servers. It enables specific versions of the library as per your configuration.
Account Defense
The account defense integration should be used on the login flow of your web application, as well as post login flows that should be protected.
Authentication
The following steps will walk you through implementing the NeuroID JavaScript Library.
1. Install the NeuroID JavaScript with your unique site_id
If this is the first time you are integrating with NeuroID JS, you must install a snippet of JavaScript in the of your webpage. This JS snippet must load on all pages where NeuroID will observe end-user behavior.
<!-- The following Snippet is for Test Purposes Only -->
<script type="text/javascript">
(function(n,e,u,r,o,i,d){
n.nid=n.nid||function(){(n.nid.q=n.nid.q||[]).push(arguments)};
o=e.createElement(u);i=e.getElementsByTagName(u)[0];o.async=1;
o.src=r;i.parentNode.insertBefore(o,i);
})(window,document,'script','//scripts.neuro-id.com/c/nid-YOUR_SITEID_HERE-test.js');
</script>
<!-- The following Snippet is for Production -->
<script type="text/javascript">
(function(n,e,u,r,o,i,d){
n.nid=n.nid||function(){(n.nid.q=n.nid.q||[]).push(arguments)};
o=e.createElement(u);i=e.getElementsByTagName(u)[0];o.async=1;
o.src=r;i.parentNode.insertBefore(o,i);
})(window,document,'script','//scripts.neuro-id.com/c/nid-YOUR_COLLECTION_SITEID_HERE.js');
</script>
Embed this JavaScript snippet within the <head> section of your webpage. This snippet will be provided by NeuroID Implementations Engineering or may be retrieved from the JavaScript Installation Settings page in the NeuroID Portal.
If you copy the snippet from here, you must update your JavaScript snippet URL to include your unique site_id. Your URL will look similar to: //scripts.neuro-id.com/c/nid-abcde123.js.
If you receive a siteid from NeuroID in the format form_abcde123, you need to remove form_ prefix before using
A NeuroID
siteIduniquely identifies the Application form for which behavioral data is collected. The format consists of the prefixform_followed by five characters and then three numbers (e.g.,form_abcde123). It is important that you do not reuse asiteIdacross multiple forms or applications. Each must be unique.
Your JavaScript snippet URL will look similar to
//scripts.neuro-id.com/c/nid-abcde123.js.In this example, the
site_idwould beform_abcde123.
2. Label Input Fields
Ensure you use descriptive names for your input fields. These will be used during configuration to identify each input field. If you do not have descriptive names, we recommend incorporating unique, stable, and descriptive data-nid-target attributes into your input fields, e.g., data-nid-target="firstName" if the input field is a first name field. Please refer to our data-nid-target documentation for more information.
3. Store NeuroID sessionId or Set a unique persistent Identifier
User data that is collected by NeuroID JS must be associated with a static identity_id. The identity_id can either be set by the NeuroID JS or must be set by your frontend JavaScript code. Your NeuroID Implementation Engineering contact will work with you to verify which pattern will be used, and configure your NeuroID JS snippets correctly.
a. Store NeuroID sessionId
NeuroID sessionId identifier is automatically generated as soon as the NeuroID JavaScript loads and data collection auto-starts. You can retrieve this identifier programmatically using the following command:
nid.getIdentityId();
Storing NeuroID sessionId
The NeuroID dashboard and alerts use a generated NeuroID identifier as the primary key for user tracking and analytics.
Additionally, the NeuroID identifier (
nid_sid) is stored as a cookie. You can access it directly from there if needed. Optionally NeuroID can configure to store NeuroID identifier (nid_sid) in the browser's session storage.To ensure seamless tracking and integration, the NeuroID identifier must be linked to your internal customer identifier. This allows for a unified view across your internal systems and the NeuroID platform.
This identifier is essential for reviewing NeuroID dashboards and alerts.
b. Set a unique persistent Identifier
Use the identify command to set a unique persistent identifier:
nid('identify', 'identity_id');
IdentityId must be valid
A customer set
identity_idmust meet all the following requirements:
- Must be a string value
- Must consist of only alphanumeric characters, dashes, underscores, or periods
- A minimum length of 3-characters
- A maximum length of 100-characters
- Must not contain any PII
The
identity_idmust be the same identifier used to persist an applicant's identity in your system. You may refer to this as an Application ID, an Applicant ID, a User ID, a Customer ID, or something similar. No matter what you call it, you must set anidentity_idthat is unique to the applicant and also exists in your system.If the unique identifier is unavailable in your database, persist the value used to your backend after creation and before calling the NeuroID Analytics API. You will use this value to call the NeuroID API for signals about the applicant.
JavaScript Installation Complete 🎉
Your JavaScript installation is now complete.
Please contact NeuroID at [email protected] to complete your site's configuration.
Visit the Advanced Functions documentation to learn more about NeuroID JavaScript functions not covered here.
Updated 15 days ago
