Skip to content

Quickstart

Terminal window
npm install writetrack

Or with yarn:

Terminal window
yarn add writetrack
import { WriteTrack } from 'writetrack';
// Initialize with a selector
const tracker = new WriteTrack('#my-textarea');
// When you need to analyze the input
const result = tracker.analyze();
console.log(result);
// {
// isAuthentic: true,
// confidence: 0.87,
// signals: { ... }
// }
<form id="essay-form">
<textarea id="essay-field" rows="10"></textarea>
<button type="submit">Submit</button>
</form>
<script type="module">
import { WriteTrack } from 'writetrack';
const tracker = new WriteTrack('#essay-field');
document.getElementById('essay-form').addEventListener('submit', (e) => {
const { isAuthentic, confidence } = tracker.analyze();
if (!isAuthentic && confidence > 0.8) {
e.preventDefault();
alert('Please type your response rather than pasting.');
}
});
</script>