0

I am writing my own home page in html and javascript.

I have many hyperlinks on the home page, which interests me is, how many times visitors of my page click on them.

For instance, <a href="paper.pdf">pdf</a> is a hyperlink which directs to downloading a pdf file. I would like to set up a mechanism of counter of clicking on it. For instance this information is automatically recorded in a file so that I could check it from time to time.

Besides counter, other information such as the time of clicking, the IP of visitors who click interest me too. It will be great if I can record them.

I don't know javascript, could anyone suggest me an efficient way to realize this with details (or a piece of code)?

4

1 に答える 1

1

あなたのコードに従って

<a href="some.pdf" id="uniqueID">PDF</a>

PDF リンクに 1 つの ID を追加したことがわかります。

$("#uniqueID").click(function(){
//Write a ajax function to calculate the count and storing
});

コード全体を書いたわけではありませんが、ロジックを理解するだけで十分だと思います。

于 2012-06-21T07:16:52.133 に答える