SDK Browser or Webview

Last updated: August 30th, 2024

Introduction

SDK Browser or Webview is a script written in Javascript that collects and analyzes user machine public informations. Through this resource is possible to identify if a machine is already known by ClearSale and what it is histoty of actions.

Script Implementation

Script Block Monitoring

In some cases, the script execution can be intentionally blocked by the client, to collect this information is necessary to implement the script block monitoring.

To include the script block monitoring, add the following code snippet before the closing tag

<noscript>
    <img src="https://device.clearsale.com.br/p/fp.png?sid=YOUR_SESSIONID&app=YOUR_APPKEY&ns=1" />
</noscript>

Include the code below in the page header or footer where the Fingerprint is implemented

<script>
    function checkUrl(url){
        let request = new XMLHttpRequest();
        request.open( "GET", url, true );
        request.send(null);
        request.onerror = (event) => {
            request.open("GET", "https://web.fpcs-monitor.com.br/p/fp.png?sid=YOUR_SESSIONID&app=YOUR_APPKEY&bl=1", false);
            request.send(null);
        }
    }
    checkUrl("https://device.clearsale.com.br/p/fp.png?app=YOUR_APPKEY");;
</script>

In the code above, the text YOUR_SESSIONID must be replaced by the transaction SessiondID and the text YOUR_APPKEY must be replaced by your APPKEY.

Inclusion Page

It is necessary that the script be on only one page of the website.

The script's execution time rarely exceeds 3 seconds, however, care should be taken to prevent the user from leaving the page before this script completes its function. Therefore, we recommend that it be a page that involves user interaction, such as filling out registration data or payment information.

Placement on the Inclusion Page

It is expressly mandatory to include the script tags at the end of the HTML page, before the </body> tag.

Compliance with this recommendation ensures that the website suffers no performance impairment in integration.

Code

The code to be included on the page, before the </body> tag, as shown in the example below:

<script>
    (function (a, b, c, d, e, f, g) {
    a['CsdpObject'] = e; a[e] = a[e] || function () {
    (a[e].q = a[e].q || []).push(arguments)
    }, a[e].l = 1 * Date.now(); f = b.createElement(c),
    g = b.getElementsByTagName(c)[0]; f.async = 1; f.src = d; g.parentNode.insertBefore(f, g)
    })(window, document, 'script', '//device.clearsale.com.br/p/fp.js', 'csdp');
    csdp('app', 'your_app');
    csdp('sessionid', 'your_session_id');
</script>

ClearSale will inform which value should be used in the word highlighted in green (your_app). It serves to identify your website in our system. As for the value highlighted in green (your_session_id), it is the user's session ID on the website. The session ID value must contain at least 6 and at most 128 characters. This parameter is extremely relevant, and the same SessionID value passed in the Behavior Analytics collection parameter must be sent to ClearSale in the "SessionID" field of the transaction/order submission API.

Definition of SessionID

The SessionID must have a unique value per session.

In certain situations, such as when using Google Tag Manager, it may not be possible to fill in the sessionid value in the deployment code block. If this is your case, you can use an input tag in your HTML and inform the tag ID in the deployment code.

Place an input somewhere on your page as suggested below.

<input type="hidden" id="MyFieldWithValue" value="My_SessionID_Value"/>

In the deployment code, simply provide the input ID from which the script will retrieve the filled value, as shown in the example below.

<script>
    (function (a, b, c, d, e, f, g) {
    a['CsdpObject'] = e; a[e] = a[e] || function () {
    (a[e].q = a[e].q || []).push(arguments)
    }, a[e].l = 1 * new Date(); f = b.createElement(c),
    g = b.getElementsByTagName(c)[0]; f.async = 1; f.src = d; g.parentNode.insertBefore(f, g)
    })(window, document, 'script', '//device.clearsale.com.br/p/fp.js', 'csdp');
    csdp('app', 'your_app');
    csdp('inputsessionid', 'MyFieldWithValue');
</script>

Note: It should be noted that for this case, the sessionid parameter must be changed to inputsessionid.


If you do not use a sessionid value on your website, we can create it for you. Remember that this value must be sent to ClearSale later.

Place an input somewhere on your page as suggested below.

<input type="hidden" id="MyFieldThatWillRecieveValue" value=""/>

In the deployment code, simply provide the input ID from which the script will generate a value for the sessionid and store it there, as shown in the example below.

<script>
    (function (a, b, c, d, e, f, g) {
    a['CsdpObject'] = e; a[e] = a[e] || function () {
    (a[e].q = a[e].q || []).push(arguments)
    }, a[e].l = 1 * new Date(); f = b.createElement(c),
    g = b.getElementsByTagName(c)[0]; f.async = 1; f.src = d; g.parentNode.insertBefore(f, g)
    })(window, document, 'script', '//device.clearsale.com.br/p/fp.js', 'csdp');
    csdp('app', 'your_app');
    csdp('outputsessionid', 'MyFieldThatWillRecieveValue');
</script>

Note: It should be noted that for this case, the sessionid parameter must be changed to outputsessionid.


FAQ

FAQ

Click here to access our FAQ

Privacy Details

Data usage

All information collected by ClearSale's SDK are exclusively for the purpose of fraud prevention and user protection, adherent to the security and privacy policies of Google and Apple platfoms and the LGPD. Therefore, this information must be in the application privacy policy.

Data Type Collected

ClearSale's SDK collects the following device information:

  • Precise location (when allowed by user);
  • Device advertising identification (when allowed by user);
  • Device physical/hardware characteristics (such as display, battery, keyboard, disk space, model, device name);
  • Device software characteristics (such as version, language, build, parental control);
  • Network information (such as connections, IP);
  • SimCard carrier.

Google Privacy Policy
Apple Privacy Policy
License

Use License

By downloading and using our SDK you are agreeing to the following license.

Copyright © 2024 ClearSale

All rights are reserved, permission is granted to use the software as is, and no modification or copying for any purpose is permitted. The Software is licensed in its current configuration “as is” and without warranty of any kind, either express or implied, including, but not limited to, warranties of merchantability, fitness for a particular purpose and non-infringement of patented rights. Under no circumstances may the Copyright holders be held liable for damages, losses, causes of action, whether in contract or tort, or other tortious action arising from the use of the Software or other actions related to this Software without the prior written authorization of the Copyright holder.