Nid - Js v3.1.6 Getting Started
Nid - Js v3.1.6 Getting Started
JavaScript Integration
nid.js v3.1.6
PURPOSE
The purpose of this document is to provide you a “Getting Started Guide” for Neuro-ID’s
JavaScript Integration. We have broken this out into 2 parts:
1. Requirements for a trial integration
2. Follow along requirements for Post-Trial/MSA partnership
Trial Integration
An integration is scoped to a specific application type or product and its related HTML
fields, referred to as targets. Please verify and confirm that all targets you would like
behavioral analytics for, are targeted with a unique HTML ID or the HTML Data Attribute,
data-neuro-attribute. Note, when integrating Neuro-ID's JavaScript library, behavioral
interaction data will not be collected for custom instantiations of targets that do not
propagate change events. We request that you follow web standards and best practices
when creating custom components.
2. JavaScript Snippets
A Neuro-ID Solutions Architect will provide you with two custom JavaScript snippets to
include on your website; one for your non-production instances (staging, UAT, dev, qa,
etc.) and one for your production site. These snippets will be script tags similar to the
following:
<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/[CONFIG_URL]');
</script>
3. Start Collecting Behavioral Interaction Data
To start collecting behavioral interaction data, the start command is called. The start
command takes a page_identifier value as an optional parameter. This page_identifer
value should uniquely identify the given page throughout the entire form. Neuro-ID
requests that this value be representative of what you refer to the page as internally to
assist in consistent uniform communication between you and Neuro-ID. Examples of
pageId values are: step_1, personal_information, bank_info, loan_offers, etc.
nid('start', [page_identifier]);
Neuro-ID's JavaScript library identifies the state of the application during interaction
based on the URL or passed in page_identifier. The library accomplishes this in two ways:
1. Automatic State Identification (default for Single Page Applications)
a. Nid.js by default tracks when the URL changes. This functionality is
accomplished by polling the current window location to determine if a
change has occurred every 200 milliseconds by default. If your Single
Page Application does not change the URL when a new view is loaded, we
strongly encourage you to call the start command with an associated
page_identifier to inform us that a new view has been loaded.
2. Manual State Identification (required for multi page applications)
a. Due to page redirects and hard page reloads/refreshes of multi page
applications, identifying state must be done manually. The Manual State
Identification option requires the start command to be called on each
page. As noted above the start command takes a page_identifier value as
a parameter.
4. Identifying the Application
The user_id is an identifier, or a hash of an identifier, that already exists in your system,
and is what you will use to retrieve predictive Neuro Confidence Scores and Neuro
Attributes via Neuro-ID's API. The user_id can be a deferred ID that should be set as soon
as your system identifies and stores information about the application being filled out. The
user_id must be set as soon as it is available after the initial nid('start', '[page_identifer]')
command is called. Use the setUserId command to set your unique identifier as the
user_id.
nid('setUserId', [value]);
5. Identifying the Funnel
To associate, identify, and segment your population by funnel, use the setVariable
command. The setVariable command takes a key-value pair and associates it to the
current session and user_id. The setVariable command can be called anytime after the
start command is called, just not before.
nid('applicationSubmit', [page_identifier]);
Once it is determined that we are ready to move to post Trial and into an MSA agreement,
additional updates may be required to your integration. These additional updates could include
the following:
● JavaScript Library Version Update
● Additional setVariable command calls to further segment the population
● Addition of setCheckpoint command calls denote reached milestones and possible
locations for API calls (for details on how to run this command see below)
● Additional target configuration to provide more coverage of HTML form elements
Identifying Checkpoints
Checkpoints are instances along the application journey that signify when a certain milestone has
been reached. These milestones represent points at which future developed Neuro Confidence
Scores can be retrieved (to retrieve Neuro Confidence Scores, the Neuro-ID API must be
integrated. This can occur after or simultaneous with the initial JavaScript integration.), as well as
points that provide valuable metadata. The setCheckpoint command requires a string parameter
that describes this point in time. Typically, customers set, at a minimum, the following
checkpoints:
● offerMade - Representing when the end user has been made an offer
● offerSelected - Representing when the end user has selected an offer
Neuro-ID will work with you to identify and set additional application-specific checkpoints. These
will be documented in your customized Technical Implementation Guide.
nid('setCheckpoint', [checkpointName]);