Keeping Track Of Number Of Clicks | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Keeping Track Of Number Of Clicks

Let's say I have a button in a web program. Every time someone clicks on the button, 1 will be added to the current number of clicks. The catch, though, is that I want to keep track of everyone's clicks in total. I'm just curious, how would I go about doing that?

17th Nov 2019, 7:08 PM
Jianmin Chen
Jianmin Chen - avatar
2 Answers
+ 1
You can use local storage. https://code.sololearn.com/WBEDb4ikkZvP/#html Edit: my bad, I completely missed your catch. 😱 If you want to count all of your users button clicks you will need a server and database or you could go the firebase route
17th Nov 2019, 7:42 PM
ODLNT
ODLNT - avatar
+ 1
So you want everyone’s clicks to be added up into a total clicks value? If so, localstorage won’t be near as useful. You’d be better off using something like firebase to keep track of everything
17th Nov 2019, 7:46 PM
Jax
Jax - avatar