flash service

High_Performance_Web_Sites

Issue link: https://read.uberflip.com/i/1146286

Contents of this Issue

Navigation

Page 103 of 169

82 | Chapter 11: Rule 11: Avoid Redirects An alternative is to use Referer * logging to track traffic patterns. Every HTTP request contains the URL of the page from which it was generated, i.e., the referer (in some cases there is no referring page, such as when the user types the URL or uses book- marks). In this example, when the user navigates to the Sports page from the Yahoo! home page, the access logs from sports.yahoo.com contain a Referer value of http:// www.yahoo.com/. Using Referer logging avoids sending the user through a redirect, thus improving response times. The difficulty with this approach, however, is that for Yahoo! home page to gather statistics on everyone leaving its site, Yahoo! has to analyze the logs of all the destination web sites (Sports, Mail, Calendar, Movies, etc.). For internal traffic—i.e., traffic from web sites within the same company—it's worthwhile to avoid redirects by setting up Referer logging to improve end user response times. If the destination web site belongs to a different company, it might not be possible to analyze the logs for Referers. This situation is discussed in the next section. Tracking Outbound Traffic When you're trying to track user traffic, you might find that links are taking users away from your web site. In this situation, the use of Referer is not practical. This is the situation faced by Yahoo! Search. Yahoo! solves the tracking problem by wrapping each search result link in a redirect. The URL of the search result goes to rds.yahoo.com and contains the ultimate destination as a parameter in the URL. For example, here's a search result link going to the entry for "Performance" at Wikipedia: http://rds.yahoo.com/[...]5742/**http%3a//en.wikipedia.org/wiki/Performance Clicking on this search result accesses rds.yahoo.com, which returns a 302 response with the Location set to http://en.wikipedia.org/wiki/Performance. Administrators can then track where users are going by analyzing the ** parameters from web server logs on rds.yahoo.com. The redirect slows retrieval of the destination page, which has a negative impact on the user's experience. An alternative to redirects for outbound traffic is to use a beacon—an HTTP request that contains tracking information in the URL. The tracking information is extracted from the access logs on the beacon web server(s). The beacon response is typically a one-pixel by one-pixel transparent image, although a 204 response is a more elegant solution because it's smaller, never cached, and by definition does not alter the state of the browser. In the case of Yahoo! Search, the goal would be to send a beacon whenever the user clicks on a search result link. This is done using the onclick handler for each link (when JavaScript is enabled). The onclick handler calls a JavaScript function that * This misspelling of "referrer" is so prevalent that it became part of the HTTP specification.

Articles in this issue

Links on this page

Archives of this issue

view archives of flash service - High_Performance_Web_Sites