Skip to content

Kount Data Collector

Sven Hindman edited this page Feb 26, 2018 · 9 revisions

Data Collector

The Kount Data Collector runs in the background while the user is logging into the website via a web clients or browser (see section below) or via a mobile app (iOS or Android). Here are the standard requirements for any Data Collection event.

ℹ️ The Risk Inquiry Service is designed to be used in conjunction with the Data Collection process. The Data Collection process is passive and provides no information back to a merchant independent of the Access Inquiry Service.

Session ID Discussion

The Session ID is the identifier for the collection event and is specific to the user’s request. You will use the Session ID for subsequent calls to the API service for device information regarding the current user’s interaction.

  • Data Collector should be run once for each user’s session within the web browser.
  • Session ID field name = sessionId
  • Session ID values should be 32 character length and must be alpha-numeric values (0-9, a-z or A-Z). Dashes (-) and underscores (_) are acceptable. Session ID values of less than 32 characters will be accepted, but it is strongly recommended to use a 32 character value.
  • Session IDs must be unique per request. They must be unique for a minimum of 30 days.
  • Script tag parameter value = s Example: s=abcdefg12345abababab123456789012.

Web Clients or Browser

The Data Collector runs on a client’s browser and collects a variety of information that helps uniquely identify the device.

Add the <script> tag and an <img> tag to the web page where you want to trigger the Data Collection to occur.

Field Parameter Value
merchantId m six digit Merchant ID number issued by Kount
sessionId s 32 character session id; see Session ID Discussion above for more information

Below is an example where the Data Collector URL is denoted with DATA_COLLECTOR_URL.This URL will either be tst.kaptcha.com for testing, or ssl.kaptcha.com for production. The Merchant ID field (m=123456) and the Session ID field (s=abcdefg12345abababab123456789012) in the example are placeholder values. The "m" value will also be supplied by Kount. The "s" value will be the dynamic session of your customer and should be a variable value.

<script type='text/javascript' src='https://DATA_COLLECTOR_URL/collect/sdk?m=123456&s=abcdefg12345abababab123456789012'></script>

ℹ️ DATA_COLLECTOR can be found at tst.kaptcha.com/ for the test environment and ssl.kaptcha.com for the Production environment.

Creating the kaxsdc Class (Responsible for Triggering Data Collection)

The Client Collector SDK data collection process is triggered by the 'load' data-event. This gives the collector the most available time to complete its work. The collection is bound to the page load event by adding the kaxsdc class and data-event=‘load’ to an HTML element, such as the HTML body or a div. (Code example below.)

Namespace & ka.ClientSDK Object

The Kount collector JavaScript is namespaced under the ka JavaScript object. It is required to have the above /collect/sdk script tag into your page, which will import the Client Collector SDK. To start using the Client Collector SDK, create a new ClientSDK object: var client = new ka.ClientSDK(); (Code example below.)

Available methods in the ka.ClientSDK object:

Method Description
autoLoadEvents() Attaches the collection process to be automatically triggered by the page elements load event with the className “kaxsdc.”
setupCallback(config) (OPTIONAL) A client programmable callback system that allows the client to execute custom code at certain points in the data collection process. This method allows a merchant to add a callback function to be called at a specified life-cycle hook. A merchant can pass a JavaScript object containing one or more life cycle hooks with a function pointer or an anonymous function to be executed.
List of hooks (in order of firing):
  • collect-begin - Triggers when the collection starts.
  • collect-end - Triggers when the collection ends.
When executed, the callback function is passed a JavaScript object containing the following properties:
  • MercSessId – The merchant provided session.
  • MerchantId – The merchant Id.

Code Example:

This code collects device information on page load and includes the option to fire an alert when the process reaches the collect-begin and collect-end hooks.

Note the following:

  • To get domain information, please contact your Kount representative
  • The Content Security Policy has been added to the header
  • The load event has been added to the class kaxsdc in the BODY - this may be attached to a different html element
  • The ka.ClientSDK is set to autorun when kaxsdc class loads
<html>
   .
<head>
<!-- Following is for Content Security Policy - For more information, please see that 
     section within this wiki --> 
   .
<meta http-equiv="Content-Security-Policy" content="img-src https://*.kaptcha.com; 
script-src 'unsafe-inline' https://*.kaptcha.com; child-src https://*.kaptcha.com">
   .
   .
</head>
   .
   .
   <!-- Adding the data-event=load to the class kaxsdc will start the Client in the autoload.  
        Note - this may be added to different data elements like a div -->
      .
   <body class='kaxsdc' data-event='load'>
      .
      .
   <!-- Get the Collector SDK.  In the example, `DATA_COLLECTOR_URL`, 'm=123456' and 
        s=abcdefg12345abababab123456789012 are placeholder values.  Both 
        DATA_COLLECTOR_URL and the "m" values will be supplied by your Kount Client 
        Success Manager.  The "s" value will be the dynamic session of your customer 
        and should be a variable representing the customer's current session ID.  -->
 
   <script type='text/javascript' src='https://DATA_COLLECTOR_URL/collect/sdk?m=123456&
      s=abcdefg12345abababab123456789012'> </script>
      .
      .
      .
      <!-- The following script starts the ClientSDK for the collection.  -->
      <!-- Optionally elements are the callbacks for when the collection starts and when the
           collection ends.  These callbacks can be useful if a business wants to be sure 
           that the collection has completed before asking for a risk evaluation (or to know 
           that a risk evaluation is being made with or without a complete set of 
           information)  --> 

      <script type='text/javascript'>
        var client=new ka.ClientSDK();
 
       // OPTIONAL
        client.setupCallback(
            {
                // fires when collection has finished - this example would not enable the 
                // login button until collection has completed

                'collect-end':
                    function(params) {
                        // enable login button
                        loginButton = document.getElementById('login_button');
                        loginButton.removeAttribute('disabled');
                        // now user can login and navigate away from the page
                    },
                // fires when collection has started. 

                'collect-begin':
                    function(params) {
                        // add hidden form element to post session id
                        var loginForm = document.forms['loginForm'];
                        var input = document.createElement('input');
                        input.type = 'hidden';
                        input.name = 'kaId';
                        input.value = params['MercSessId'];
                        loginForm.appendChild(input);
                    }
            }
        );
        // END OPTIONAL SECTION

        // The auto load looks for an element with the 'kaxsdc' class and
        // data-event equal to a DOM event (load in this case). Data collection begins
        // when that event fires on that element--immediately in this example

        client.autoLoadEvents();
      </script>
   </body>
</html>

SDK for Native Mobile Apps (iOS and Android)

The implementation of the Client Collector is somewhat different for native Mobile Apps. Kount has a native Mobile SDK for both iOS and Android which is compatible with both the Kount Complete and Kount Access products. By using the native Mobile SDK, along with a Merchant ID, Session ID, and custom URL for posting, native mobile apps can take advantage of the added capabilities from these native SDKs. These native Mobile SDKs collect more data and increase the reliability of more consistent fingerprint across the life of a device.

The Data Collector SDK for Android provides a java jar file which can be used to perform Device Collection interaction with Kount for native Android applications.

ℹ️ The Access Inquiry Service is designed to be used in conjunction with the Data Collection process. The Data Collection process is passive and provides no information back to a merchant independent of the Access Inquiry Service.