So, you want to track whether an email recipient views your email, and track their activity in your website? Let’s build a simple Email Tracking system, but not one with nefarious intent. Using Transparent GIF images to track emails is an old school method, albeit a valid one.
The process is rather simple at its core, but can become complex with the many layers and flavors of tracking options. In essence we want to send emails to people and discover whether they have viewed their email or not. In addition, we want to do this in a polite way, and must take note that we cannot force the recipient to reveal the fact that they viewed their email. Most email browsers today have image blocking to prevent this type of tracking system from working. The method for tracking and blocking are really one in the same.
An HTML email is essentially just a web page sent inside an email. The HTML can reference pretty much anything a web page can, but not everything will work the same. Text, style sheets, images and some media load and display the same as in a standard web browser. However, not all email browsers are the same, and most are not the same as standard web browsers. Loading Flash media, for example, is currently a risk. Odds are it won’t work correctly, because most email browsers do not support plug-ins the way standard web browsers do. There are many exceptions to the expectations, in the form of HTML and style code handling. The biggest beast to be frustrated by is pretty much any flavor of Microsoft’s email browsers like Outlook or Entourage. You must therefore create a basic approach to an HTML email display that works across all email browsers similarly.
Back to GIF images… The question arises as to why tracking requires a GIF image. The fact is there is no requirement that the image be a GIF, nor that it be transparent. Near the beginning of email tracking, companies were trying to hie their tracking systems and behaved more like spammers than legitimate email campaigners. They would use a 1pixel square transparent GIF, which would not disrupt their email layout as much if it didn’t load in the email browser. Handling the display of a missing image can be a task in itself, and is another issue altogether.
Images are used to track email views, since they are externally/globally references by the HTML email code. The image must be downloaded from the web server, which can be tracked for statistical analysis. The method by which the image is served and tracked is an important one. The most common method for serving an image from a web server is to reference the image directly. This would require a server-side web server tracking system, which means the server needs to know that requests for the specific image must be tracked and counted. This is a clumsy and antiquated method for tracking with images.
Images may be served in a variety of methods, and the easiest method which provides the best results is to use a code-level image distribution. This means using a server-side language like PHP Programming to perform the action. The request for the image is actually a request for a PHP Script. the PHP Script can handle multiple tasks for tracking, then access the image file data to feed to the email browser with appropriate headers and other bits. Since PHP provides the fastest turnaround speeds, the tracking and file read/write handling is transparent to the viewer.
The next question is how to associate the individual user to the image requested for more detailed tracking results. Simply tracking the number of times a specific image is viewed gives us a bulk number, but not much actionable data to work with. Knowing which email recipient viewed which email, how many times, on what dates and times, from what browser type and other tracking statistics gives us actionable data. This requires an additional layer of tracking data that must be seeded prior to the initial campaign release. Else, a blind email results in blind data.
When preparing your campaign to release, your database or list will have a series of unique email addresses. This single data type is sufficient for tracking individual email views, clicks, and other data types. You must decide whether to use encrypted tracking tokens or use the email address in its native form. It would be better to encrypt the email address in some way, but beware the caveat of using the ID Number for the line item in your database of list containing the email addresses! If you use an incremented or predictable numbering system, any semi-aware hacker can iterate your tracking system to abuse your data, extract your email address list, opt-out all of your recipients, or perhaps worse! Make sure that tokens for tracking are not predictable, incremented, or could be reverse engineered to discover your entire list.
Integrating tracking tokens in your emails is simple. However, the implementation of tracking tokens requires some PHP Programming expertise. Every email delivered must contain unique code, which may additionally include the recipient’s name and perhaps personal information, but must contain the single tracking token to link the views and clicks back to your email database or list. The token is part of the image request code, which is sent back to the web server with the image request every time the email is viewed. As a side note, the same method may be used on all clickable items, as long as the server-side code is programmed to handle the request and increment the database or list, then handle the expected request for images or web pages.
Method One: Query String URLs
The most common URL structure for tracking tokens (variable-value pairs) is to use the old fashioned question mark followed by variable names and variable values. These take the form of http://www.phpkemist.com/email-campaign/image-request.php?token=abc123 and so on. The image request is sent to the phpkemist.com server for the email-campaign directory containing the image-request handler script. This script is programmed to expect a value inside of the variable named “token” and thus tracking begins.
Method Two: Pathway URLs
Similar to the above method, but more modern and SEO friendly, URL pathways pass the campaign specifications and the token in a slashed notation in the form of http://www.phpkemist.com/email-campaign/image/abc123 that is filtered by the .htaccess file and subsequently handled by the declared target PHP Program. PHP must first explode the Request URI into pieces, then select the correct values to handle tracking.
In both of these methods, the tracking system has multiple features, the range of which your campaign tracking requirements will dictate. The simplest and core tracking component is the email address counter incrementing. The token value must match an entry in your email database or list, whether the token be the email address in plain text or as a string that must be first decrypted. Your choice for encryption must be selected with consideration for the resulting character set, else some characters will break your URLs and thus break your tracking. Say for example, your URI or query string contained an unexpected question mark or pound symbol. These obviously create some problems for some PHP Programs, unless specially handled. It’s better to eliminate such exceptions in handling and stick to the basics. There are methods for encrypting tokens that are clean and predictable for your code, while obfuscating your list or database or emails.
It is ideal to track the time that each email is sent. The time the email is first viewed as well as the last time it was viewed provides both validation that the email was viewed, as well as how quickly the email was viewed after being sent. Profiles can be constructed to indicate which people view their emails quickly, and which are slow to wake up and check their email. Knowing the last time the email was viewed additionally indicates interest in the email content, that the email was passed to another recipient, or that the viewer has multiple email browsers or is perhaps has a poor memory! As a side note, you can track if the email is passed to another recipient using systems such as GPS tracking based on IP Addresses and the time of viewing. If the recipient views the email in california, then views it 20 minutes later in Washington, you can make a decent assumption that the email was forwarded to another recipient. You won’t be able to directly track the email address of subsequent recipients.
Tracking views is useful information. But you should take your campaign a few steps further. Actionable items such a invites, offers, and interesting information mean more great data for statistical analysis. Knowing which actionable item in the email was clicked can provide another layer of tracking that will improve your campaigns successively. Did the recipient click the image link or the text link? Did the link at the top get a response, or in the middle or at the bottom? It is possible to track if the recipient simply moves the mouse over a link or image without clicking them.
Once a recipient clicks through to your target page or application, tracking should continue. Tracking the email content alone is just one step toward useful data analysis. Setting a session and tracking the user into each page of the site or application will improve statistics for interest and profile building. Return visits and repeat viewing of the same material may trigger an internal alert for administrative of sale force response. Perhaps on the third visit to the same promotional product, a message is displayed indicating the product can be purchased right now for 30% off, in an attempt to close the deal and convert a browser to a customer. The semantics of sales tactics and tracking analyses are left up to you and your campaign specifications and requirements. There is seemingly no limit to the number of ways you can track data, analyze the points, and create compelling reports that can be quickly used by others and used to create successively successful campaigns.
The PHP Kemist integrates many layers of tracking, analysis and reporting for email campaigns of many types. We believe that tracking data holds the keys to campaign success, cash flow potential, and fulfilled customers. if you have questions about bulk email campaigns, call us at 801-253-2564 or send email to email at phpkemist dot com