If You are using asp.net MVC, the backend code is something like this.
public RedirectResult LogToDbRedirect()
{
string username = HttpContext.Session.GetString("username");
SaveToLog(username, "abc.com", "https://xyz.com" );
return Redirect("https://xyz.com");
}
You need 1 table to save url click log, containing columns:
-id
-sourceUrl
-redirectToUrl
-username
-Timestamp