Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Zeta Links

0.00/5 (No votes)
22 Nov 2009 1  
A web application for generating and measuring shortcut hyperlinks, similar to bit.ly
Click for larger image

Introduction

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).

Workflow

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:

  1. The administrator configures a hyperlink with the symbolic name "my-new-setup", pointing to "http://www.my-other-cool-website.com/downloads/files/setup-1.4.0.5.exe".
  2. The hyperlink is placed on a website as "http://www.my-cool-website.com/links/my-new-setup".
  3. A visitor clicks the hyperlink.
  4. Since a real resource named "my-new-setup" does not exist, the configured HTTP 404 handler is being called by IIS.
  5. The ASPX page of the configured HTTP 404 handler looks into the database for an entry with the symbolic name "my-new-setup".
  6. 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.
  7. The hyperlink click count of the database entry is increased by one.
  8. The user's web browser opens the real destination URL.

Architecture

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.

Features

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

Click for larger image

This form enables you to create a new or edit an existing hyperlink.

Displaying Statistics

Click for larger image

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.

Epilog

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.

History

  • 2009-11-23 - First release

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here