I would like to create a link where the href performs a GET from my server first to record a view metric before redirecting to the external page.
How do you create a click through A link where hovering over the link shows the external destination url, however, clicking on the first goes to my metric page which redirects to the real external page?
I thought of something like this. The title is only on hover and not on the status bar.
<a href="/metric/id" title="http://www.example.org">http://www.example.org/</a>
Sites like google search results do this.
I tried searching for this. Like this question, I am not even sure what this is called.
thanks
(please feel free to retag)
I’m not familiar with a way to do this, but you could attach an onClick event to your link and have that call a function that fires off an AJAX request to your metric URL so that you can record it before the link is followed.
Your link would become
And then in JavaScript (using jQuery here to make this faster/its awesome)