Web SDK Reference

Class CredoAppService(url, authKey)

CredoAppService(url, authKey)

CredoAppService enables the tracking of user behavior and the capture of a user’s digital footprint. The collected information is uploaded to the credolab web service for future use as scorecards and fragments.

Creates an instance of the CredoAppService with a target configuration:

Parameters:

NameDescriptionType
urlThe URL of credolab serviceString
authKeyAn authentication key can be obtained from the credolab team.String

Method startTracking()

startTracking()
  • The method is intended to start the tracking of user behavior on the page where the credolab SDK is integrated.

Method stopTracking()

stopTracking()
  • The method is intended to stop the tracking of the user behavior on the page where the credolab SDK is integrated.

Method stopTrackingAndCompleteAsync(referenceNumber)

stopTrackingAndCompleteAsync(referenceNumber): Promise<void | CredoAppException>
  • This method is intended to terminate the tracking, collecting and uploading of data to the credolab web service. If the method executes successfully, it means that the dataset is considered completed, and the reference number cannot be used again.

Parameters:

NameDescriptionType
referenceNumberUnique identifier intended to associate dataset, uploaded to credolab web service, with a record on the lender side. (The max length of 100 characters).String

Returns:

TypeDescription
Promise<void | CredoAppException>Promise result contains an object that represents the eventual completion (or failure) of an asynchronous operation. If an error occurs, CredoAppException will be passed to the failure with the error detail



Class CredoAppServiceAsync(url, authKey)

CredoAppServiceAsync(url, authKey)

With CredoAppServiceAsync, users' behavior and digital footprint data are continuously tracked from different devices, and they are uploaded continuously to the credolab web service for processing into scorecards and fragments.

Creates an instance of the CredoAppServiceAsync with a target configuration:

Parameters:

NameDescriptionType
urlThe URL of credolab serviceString
authKeyAn authentication key can be obtained from the credolab team.String

Method startTrackingAsync(referenceNumber)

startTrackingAsync(referenceNumber): Promise<void | CredoAppException>
  • The method is intended to start the tracking of user behavior data and continuously upload it to the credolab web server.
    Please note that it is not possible to initiate tracking with a new reference number if there is already ongoing tracking associated with another number. In such cases, an error will be returned, indicating that tracking for a certain reference number is currently in progress.

Parameters:

NameDescriptionType
referenceNumberUnique identifier intended to associate dataset, uploaded to credolab web service, with a record on the lender side. (The max length of 100 characters).String

Returns:

TypeDescription
Promise<void | CredoAppException>Promise result contains an object that represents the eventual completion (or failure) of an asynchronous operation. If an error occurs, CredoAppException will be passed to the failure with the error detail

Method stopTrackingAsync()

stopTrackingAsync(): Promise<void | CredoAppException>
  • The method is intended to stop the tracking of the user behavior on the page where the credolab SDK is integrated.

Returns:

TypeDescription
Promise<void | CredoAppException>Promise result contains an object that represents the eventual completion (or failure) of an asynchronous operation. If an error occurs, CredoAppException will be passed to the failure with the error detail

Method stopTrackingAndCompleteAsync()

stopTrackingAndCompleteAsync(): Promise<void | CredoAppException>
  • This method is intended to stop the tracking, collect data from the browser, and upload it to the credolab web service along with behavioral data. If the method executes successfully, it means that the dataset is considered completed, and the reference number (used in startTrackingAsync method) cannot be used again.

Parameters:

NameDescriptionType
referenceNumberUnique identifier intended to associate dataset, uploaded to credolab web service, with a record on the lender's side. (The max length of 100 characters).String

Returns:

TypeDescription
Promise<void | CredoAppException>Promise result contains an object that represents the eventual completion (or failure) of an asynchronous operation. If an error occurs, CredoAppException will be passed to the failure with the error detail



Return type promise<void | CredoAppException>

Promise result contains an object that represents the eventual completion (or failure) of an asynchronous operation. If an error occurs, CredoAppException will be passed to the failure with error details.



Class CredoAppException

This exception is passed to the Promise failure results when the credolab SDK is unable to complete an action.


Method getMessage()

getMessage()

Returns:

TypeDescription
StringGet detailed information about the error that occurred

Method getCode()

getCode()

Returns:

TypeDescription
NumberGet error code

Members:

credolab informs API clients of both the high-level error class (using the status code) and the finer-grained details of the problem. The latest approach is [RFC 7807]-based.

PropertyDescription
Status integerReturns code of the error. Please refer to the error codes table
Title stringA short, human-readable summary of the problem type.
Detail stringA human-readable explanation is specific to this occurrence of the problem.
Type stringA URI reference that identifies the problem type.

Error Codes

CodeReasonDescription
30Tracking is not started successfullystartTracking() action has not started correctly due to e.g. reference number provided was expired or completed (the related error has been received earlier)
31 Tracking in progressTracking for a specific reference number is currently in progress. To track a different number, you will need to stop tracking the current one.
40Value is invalidThe value is invalid.
Example:
Auth key is invalid
Url is invalid
41The Dataset state is invalidThe reference number is not unique 
Dataset is in a complete state
A reference number is expired
42Auth credentials are incorrect or action forbiddenThe provided credentials don't match.
50Server errorSomething is wrong with the server.
90Unknown errorAn unexpected error occurred.