Hello. I’m thinking a situation.
Clicking a “visit website” link from my site will redirect visitor to a site. Its easy know. but, when they click, it will also store the hit number also. Here, I don’t want to send the visitor to a page and save the hit to database and send him to the specific site. Both the hit save and redirection need to be done at a time.
Only two ways to accomplish this… first way is what you described but don’t want to use and second way would be to use AJAX. Write a script that records the click and then sends the visitor to wherever the link is pointing. Just as guido2004 mentioned, you need to keep in mind that this wouldn’t work if JS is disabled.