start
The start command may be used to manually start a session.
To start the collection of behavior signals for a user transaction, use the start command. The start command takes optional additional parameters to separate the signals collected across multiple pages in your application. The NeuroID JavaScript library will autostart by default, and manually starting the collection is not recommended for most users.
<!-- Calling start (legacy) -->
nid('start');
<!-- Optionally calling start with a page identifier -->
nid('start', page_identifier);
<!-- Optionally calling start with a callback function -->
<!-- Creates and returns an NID generated sessionId -->
<!-- Available in versions V5.2.0 and later -->
nid('start', function(result) {
console.log(result.sessionId);
console.log(result.status);
});
<!-- Optionally calling start with additional options -->
<!-- Can be used to set linkedSiteId, sessionId and page identifier from start -->
<!-- Available in versions V5.2.7 and later -->
nid('start', { sessionId: session-id, pageUrl: url, linkedSiteId: form_linkd123 });
<!-- Optionally calling start with additional options, and a callback function -->
<!-- Sets the values provided in additionaloptions and creates an NID generated sessionId if not provided -->
<!-- Available in versions V5.3.0 and later -->
nid('start', { linkedSiteId: form_linkd123, pageUrl: url } , function(result) {
console.log(result.sessionId);
console.log(result.status);
});
Parameters
start
: commandpage_identifier
(string): name of the page on which signal collecting is starting.
You may optionally pass thestart
command apage_identifier
value as a parameter. Thispage_identifer
value uniquely identifies a given page throughout the entire form.
For the best user experience, NeuroID recommends that this value represent what you internally refer to the page to assist in consistent uniform communication between your application and NeuroID.
Examples ofpage_identifier
values arestep_1
,personal_information
,bank_info
,loan_offers
, etc.Optional params object
: An object with a list of properties passed in by the customer as key value pairs- Supported properties:
linkedSiteId
: The siteId of theuse-case
that data collection is starting for.sessionId
: Customer provided sessionIdpageUrl
: Customer provided page identifier value
- Supported properties:
function(result)
: Calling start with a callback function will generate anid
assignedidentityId
when the script is started. This option is provided if you wish to call the API for signals before you have your ownidentityId
available.
Manual Start
The following steps outlined how to start the JavaScript manually:
- Set autostart to false in the JavaScript configuration
Set'autoStart':false
in your site's JavaScript configuration in the portal. Don't forget to save the changes. - Add start tag to your site's code
The start command should be called in your code where you'd like to start tracking inputs.
nid('start', page_identifier);
- Set a unique identifier
Call
nid('identify', identity_id);
nid('identify', identity_id);
to provide a unique identifier for the applicant after thenid('start', page_identifier)
command is called.The NeuroID JavaScript library identifies the state of the application during interaction based on the passed in
page_identifier
.Due to page redirects, hard page reloads, page refreshes, and updates of views, the NeuroID JavaScript library requires the
start
command to be called on every page load.Calling
start
multiple times has no adverse impact and allows NeuroID to collect data on complicated forms with multiple entry and exit points.
Considerations
The NeuroID JavaScript library identifies the state of the application during interaction based on the page_identifier
parameter.
Due to page redirects, hard page reloads, page refreshes, and updates of views, the NeuroID JavaScript library requires the start
command to be called on every page load.
Calling start
multiple times has no adverse impact and allows NeuroID to collect data on complicated forms with multiple entry and exit points.
iframes
If users access your application through an iframe embedded on a page outside of your domain, calling
nid('start');
multiple times may result in an error.When using the manual start option with iframes, call start only once and use the stateChange command to pass NeuroID additional context around view or page changes.
Immediate Start
Because the NeuroID JavaScript is loaded asynchronously, you cannot call start
immediately after the load call in the <head>
as this will introduce a race condition.
If you want to load the JavaScript and have it start immediately, you will need to modify the JavaScript snippet as shown here:
(function(n,e,u,r,o,i,d){
n.nid=n.nid||function(){(n.nid.q=n.nid.q||[]).push(arguments)},n.nid.q=n.nid.q||[];
o=e.createElement(u);i=e.getElementsByTagName(u)[0];o.async=1;
o.src=r;i.parentNode.insertBefore(o,i);
n.nid.q=[['start', page_id_variable]].concat(n.nid.q);
})(window,document,'script','//scripts.neuro-id.com/c/nid-YOUR_SITEID_HERE.js');
Updated 7 months ago