I suppose JavaScript would be my best option for this because it's a client side.
There are two ways you can click a link which I will be focusing on - you can click the link OR right click it and select open in new tab.
How would I detect whether the user has clicked the link or opened it in a new tab?