Tracking links to external URLs

Mark Elliott asked on October 24, 2016 21:18

Does anybody know of the best way to track which external URLs a user clicks? We have a resources page with a lot of links to external resources and are trying to determine which links are being used.

Correct Answer

Richard Sustek answered on October 24, 2016 22:29

I've recently implemented this exact scenario using:

Basically the idea is that you will use custom macro to which you will pass the URL of the link and the macro will rewrite the url so that it points to the ASHX handler and passes the target url as a query string. Then the ASHX handler takes the target(final) URL from the query string, logs it as custom activity and then redirects user to the target URL.

Finally you can create custom report which will show you the list of most clicked links.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Mark Elliott answered on October 25, 2016 17:03

Thanks Richard! Makes sense. I'll work on implementing it this way.

Thanks!

0 votesVote for this answer Mark as a Correct answer

Richard Sustek answered on October 25, 2016 22:00 (last edited on October 25, 2016 22:00)

Awesome, you're welcome.

Btw: I've been working again on this requirement myself and I figured that instead of using ASHX handler you can use HttpHandler instead which is preferable in most cases. In your case a simple redirect handler could look like this:

[assembly: RegisterHttpHandler("Redirect", typeof(RedirectHandler ), Order = 1)]
namespace Advantage.Handlers
{
    public class RedirectHandler : IHttpHandler
    {     

        #region IHttpHandler members

        public bool IsReusable
        {
            get
            {
                return true;
            }
        }

        public void ProcessRequest(HttpContext context)
        {
           // redirect here
        }

        #endregion
    }
}
1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.