How to record user's keystrokes?

LiveSession protects end-users privacy on default, so it doesn't track what people type in into inputs. If you want to enable keystrokes tracking, then you have two possible methods to do so:

1. Enable global keystrokes tracking

Add keystrokes: true to your tracking code options object - __ls("init", "YOUR_TRACK_ID", { keystrokes: true }). If you use this method then LiveSession will track every input in your application (excluding passwords and credit cards).

After change, it should look like that:


<!-- LiveSession.io code -->
<script type="text/javascript">
!function(w, d, t, u) {
    if (w.__ls) return; f = w.__ls = function() { f.push ? f.push.apply(f, arguments) : f.store.push(arguments)};
    if (!w.__ls) w.__ls = f; f.store = []; f.v = "0.1b";

    ls = d.createElement(t); ls.async = true; ls.src = u;
    s = d.getElementsByTagName(t)[0]; s.parentNode.insertBefore(ls, s);
}(window, document, 'script', ('https:' == window.location.protocol ? 'https://' : 'http://') + 'cdn.livesession.io/track.js');

// CHECK LINE OF CODE BELOW, IT'S IMPORTANT 
__ls("init", "YOUR_TRACK_ID", { keystrokes: true });
__ls("newPageView") 
</script>
<!-- LiveSession.io code -->
      

To exclude input from tracking manually you can add data-ls-disabled property to your HTML inputs.

<input data-ls-disabled type="text" placeholder="Sensitive value"/>

2. Whitelist specific inputs on your website

Another option is to track only specific inputs that are important for you. Add data-ls-enabled to input which value you want to track.

<input data-ls-enabled type="text" placeholder="My unicorn name"/>

Didn’t find an answer?

Try using the search engine or just contact us

[email protected]Chat with us

Start using LiveSession for free now.

Free 14-day trial

No credit card required

Easy setup