SDK Browser or WebView is JavaScript that collects and analyzes public data from user machines. This tool will let us know if the machine is known to ClearSale and its history of activity.
The script must be on a single website page.
The time to execute the script is unlikely to be longer than 3 seconds. However, care must be taken that the user stays on the page until the script completes. For this reason, we recommend that this be a page representative of user interactivity, such as filling in personal information or payment data.
Script tags must be included at the bottom of the html page before </body>.
Following this recommendation ensures the website will not suffer any performance issues during integration.
Code to be included in the page just before the </body> tag, as per 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_clientid’);
csdp('sessionid’, ‘your_sessionid’);
</script>
ClearSale will provide the value to be used for the word in green (your_clientid). It will identify your website in our system. The value in green (your_sessionid) is the user session id on the website. The session id must be between 7 and 128 characters. Again, this parameter is extremely important as it is the same SessionID being used in the Behavior Analytics data collection parameter sent to ClearSale in the transaction/order API "SessionID" field.
In certain situations, such as when using Google Tag Manager, it is impossible to enter the SessionID value in the implementation code block. If you run into this situation, you may use a tag input in your html and provide the tag id in the implementation code.
Use the input as suggested below somewhere on your page.
<input type="hidden" id="MyFieldWithValue" value="your_sessionid"/>
The only requirement to use is the input id. The script will search for the completed amount, as per 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_clientid');
csdp('inputsessionid', 'MyFieldWithValue');
</script>
If you do not use the sessionid value in your website, we can create the ID for you. Remember that this value must be subsequently sent to ClearSale.
Add the input as suggested below someplace on your page.
<input type="hidden" id="MyFieldThatWillReceiveValue" value=""/>
All you need to use in the implementation code is the input id. The script will generate a value for the sessionid and store it there. See 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', 'MyFieldThatWillReceiveValue')['MyFieldThatWillReceiveValue];
</script>
By downloading and using our SDK you are agreeing to the following license.
Copyright © 2021 ClearSale
All rights reserved. This license grants permission to use the software "as is". The software may not be modified or copied for any purpose. The Software is licensed as configured and with absolutely no expressed or implicit guarantee, including but not limited to marketing guarantees, suitability for specific purposes and non-violation of patented rights. Under no circumstances may the owners of the Copyright be held liable for damages, losses, basis for lawsuits due to contract or illegal acts or any other illegal means arising from the use of the Software or other actions related to this Software without the prior written authorization of the copyright holders.