The same way that they know that you clicked on literally anything on their website.
It's foundational to how the modern internet works (more specifically JavaScript)
For a more visual example, let's say there is a button that makes an animation or changes color when you hover over it.
That is happening because of code running in your browser that was written by the website that served it to you, in order for the button to know to change, the code must know where your mouse is and if the mouse is hovering over the button.
Your browser, emits 'events' which the JavaScript code is able to interact with, these are things like keystrokes and mouse actions. The JavaScript running on the page can very trivially record these actions.
Every single way you interact with a website can be tracked, here is a commercial product that specializes in complete session recording (in theory to see how your users interact with your pages to make improvements: https://mouseflow.com/platform/session-replay-tool/
Addendum: Yes we know that you think ml/hexbear/grad are tankies and or .world are a bunch of liberals but it gets old quickly. Try and come up with new material.
This is not the place to start flamewars between Lemmy, Mbin and Piefed.
The same way that they know that you clicked on literally anything on their website.
It's foundational to how the modern internet works (more specifically JavaScript)
For a more visual example, let's say there is a button that makes an animation or changes color when you hover over it.
That is happening because of code running in your browser that was written by the website that served it to you, in order for the button to know to change, the code must know where your mouse is and if the mouse is hovering over the button.
Your browser, emits 'events' which the JavaScript code is able to interact with, these are things like keystrokes and mouse actions. The JavaScript running on the page can very trivially record these actions.
Every single way you interact with a website can be tracked, here is a commercial product that specializes in complete session recording (in theory to see how your users interact with your pages to make improvements: https://mouseflow.com/platform/session-replay-tool/