Can I count clicks on links with javascript?
You should count these requests server-side, either straight from the web server logs or from the code that resolves the ?id=1234 to load the actual content.
Don't count requests coming from the page author that you gave the ID to, assuming you have some way to tell (a login, a cookie, an IP address) -- this part would be easier from your code rather than the server logs.