How we can keep tracking a link using Javascript? | SoloLearn: Learn to code for FREE!

+1

How we can keep tracking a link using Javascript?

I want to keep track link as user click on it and see how many times is get clicked by user is an <a> with link on it

3/25/2020 7:38:13 PM

Sofian Bekkari

8 Answers

New Answer

+2

For that will be needed for example PHP language. Then you can keep the number of clicks in a file (for example .txt). With each click the file will be updated. You need the tutorial as follows: https://www.sololearn.com/learn/PHP/1846/

+1

You could use local storage..... No need of PHP

+1

Thanks guys! I will try out

0

I am not very good at js But according to my sense the code something like that : let count = 0; $('a').onclick(() => count++); onclick is event listener $ is jquery selector inside event listener there is an es6 function

0

Thank you brother! is look so simple and light code, But there other issues I'm not mention it is how to stored value for example to google sheet or somewhere else when I can see it ?

0

I don't understand your question well But if you store the no of times the link clicked you can also display it. In variable case using console or alert For google sheet or other there May be some other procedure

0

Thanks Saad for your help anyway :)

0

Sofian Bekkari welcome I hope some one good may help you