This articles introduces a web application that allows you to create shortcut hyperlinks to arbitrary URLs and monitor their usage (i.e. who clicks it). So to some degree, this application can be compared to the various URL shorteners out there, like TinyUrl.com or bit.ly.
In contrast to the URL shorteners, my goal was not to provide shorter URLs but solely to monitor the usage of the hyperlinks.
For example, I route every download of the executable of the setup of our CMS Zeta Producer through an URL of Zeta Links. Since the setup executable cannot be tracked by web analysers like Google Analytics, this is my only chance to actually track the usage of the download hyperlink (sure, I could analyse the server log files, but that was too low-level for our scenario).
If everything is set up correctly, you could use hyperlinks like e.g. http://www.my-cool-website.com/links/my-new-setup.
The "workflow" of the URL resolving goes like this:
- The administrator configures a hyperlink with the symbolic name "my-new-setup", pointing to "http://www.my-other-cool-website.com/downloads/files/setup-184.108.40.206.exe".
- The hyperlink is placed on a website as "http://www.my-cool-website.com/links/my-new-setup".
- A visitor clicks the hyperlink.
- Since a real resource named "my-new-setup" does not exist, the configured HTTP 404 handler is being called by IIS.
- The ASPX page of the configured HTTP 404 handler looks into the database for an entry with the symbolic name "my-new-setup".
- If the HTTP 404 handler finds an entry, the entry is loaded, its destination URL is read and a HTTP 302 redirect is sent back to the user's web browser.
- The hyperlink click count of the database entry is increased by one.
- The user's web browser opens the real destination URL.
The application consists of the following building blocks:
- A main web application that provides the administrative GUI to create, modify, monitor and evaluate the hyperlinks.
- A Microsoft SQL Server database that stores the information about the hyperlinks.
- An optional satellite web application that can be used to use Zeta Links on a remote server. More on this below.
I'll quickly discuss these parts in the following chapters.
Main Web Application
The main web application is an ASP.NET 3.5 C# project. You can deploy it to a Microsoft Windows 2003 Server or a newer server version.
You configure the application just as every other ASP.NET application, too, i.e., adjust the settings in the "web.config" file. In addition, you have to configure IIS to route every HTTP 404 request to an ASPX file of the application.
Example of a user defined HTTP 404 error handler (sorry, German only, but you may get the idea).
SQL Server Database
The download of the application contains a SQL script for Microsoft SQL Server 2005 or higher to create an empty database.
Once it has been created, you have to configure the connection string to the database in the "web.config" file of the ASP.NET web application.
Satellite Web Application
The idea of the satellite web application was born when we first used Google AdWords to advertise products.
Since I wanted to measure who came from a click through our Google AdWords ad to the landing page, I set up a new entry in Zeta Links and entered that URL in Google AdWords. Unfortunately Google forces you to have the domain name of the URL that is being shown to the end-user of a Google AdWords ad to be the same as the actual hyperlink being redirected to.
Now I had a problem: Zeta Links was set up on domain A on server 1 whereas the destination URL for our ad was set up on domain B on server 2.
One possible solution was to simply copy the web application and the database and duplicate it on server 2. What I would have lost through this solution is the ability to have all information in one place.
So I developed a different solution:
- Create a SOAP web service in the main web application to provide the core service of resolving a Zeta Links URL to the destination URL.
- Create a very lightweight web application (what I call "Satellite web application") to just have a HTTP 404 redirect handler, no GUI.
- Let the satellite web application call the SOAP web service of the main web application.
- Configure the satellite web application on server 2.
Although this is no high-performance solution, it worked pretty well in our scenario.
So use the satellite web application if you require to have provide Zeta Links hyperlink resolving on different servers, even across data center boundaries. Ignore it otherwise.
The main web application consists of a simple, but for our scenarios just right, GUI. This chapter shows you some screenshots to give you an expression of the functions.
Creating a New Hyperlink
This form enables you to create a new or edit an existing hyperlink.
This page shows you the clicks on a given hyperlink within a configurable time span.
Important information include:
- The number of clicks, including those by humans and by web crawlers/spiders
- A graphical diagram of the clicks
- "Notes" that enable you to place tick marks in the diagram for important events
- Detailed information on which IP address clicked the hyperlink
The Application Code
When looking at the application code, you probably will be shocked that you discover nothing groundbreaking.
The main web application uses the "App_Themes" ASP.NET to build its GUI, so if you want to change the look and feel of the administration area, simple modify the files in this folder.
I have published this article in the "Utilities" section to indicate that the article contains little exciting code and is more of a foundation for similar projects you plan to develop.
This article introduced a working "real-world" application to create, manage and evaluate shortcut hyperlinks.
As always, I would love to get your feedback, suggestions and enhancements. Feel free to drop me a note below in the discussions section of the article.
- 2009-11-23 - First release