How do I store user input or clicking?

I’d like to store data when a user clicks an element. How do I go about that?