I want to store clicks from outbound links into database. And I need to have normal links in href parametres, like href="http://www.example.com". The way I am considering is to do it by changing URL with JS when user click on link. "onclick" -> link is changed from "http://www.example.com" to "example.net/redirect/product-xyz/" -> data is stored into database -> user is redirected to "http://www.example.com" But, It's "kosher" for google? Could it be penalised?
[edited by: brotherhood_of_LAN at 3:31 pm (utc) on Jun 15, 2014] [edit reason] generalised link [/edit]
I think that as long as you are redirecting to the exactly the same URL to which you are linking in href you should be fine.
In fact this is very similar to how Google Analytics Outbound links tracking works [support.google.com...]
What I would do however is make sure that the target URL is passed on as a parameter to the redirect script. This would ensure that you do not have the same URL redirecting to different targets (which would happen if you perform redirect based on, lets say, referrer).
The reason it was replaced with example.com and example.net was to ensure that anyone can see that it is redirecting to a different domain, while still following the forum TOS to always use "example.com" in place of posting actual domains here.