All of my reports list a single page from my website, why? (posted: 8/8/2008)
Many websites today, especially sites that use content management systems, have dynamic URLs. A dynamic URL is a web address created on-the-fly by a scripting language running on a web server. When the web server delivers a web page to a visitor, the URL recorded in the web server log file usually contains the actual name of the processing script followed by a list of variable�value pairs (called GET variables) used to generate the content displayed to the user. A typical dynamic URL looks something like this:
http://www.foo.com/script.php?s_id=1234&req=23hd&prod_type=book
The GET variables are separated from the script name with a question mark (?) and the individual variable-value pairs are separated from each other by an ampersand (&).
Google Analytics (GA) will record all of the above data in a log file, process it into smaller fields and populate database tables that are ultimately used to generate your GA reports. Only certain parts of the processed information are used to create the report data. In particular, the name of the script, called the request stem in GA, is used as the basis for many of the reports. The request stem is simply the name of the script on the server.
Here's a quick example. Say you have a dynamic website that has only one script named index.php. The website content is driven by a variables passed to the index.php script. Every time a user requests a page you would see a record in the log file that contains something similar to this:
http://www.foo.com/index.php?p_id=345
http://www.foo.com/index.php?p_id=897
* Note, the log file contains much more data which has been omitted for clarity.
While the same script is called in all three cases above, the variable named p_id drives the content that is displayed to the user. Each example above equates to a different page on the site that needs to be tracked individually. Unfortunately the request stem value for each of the above hits is the same so you would see three hits to index.php not one hit to three different pages as you would want.
A quick solution to the above problem is to change the value of the request stem field. Modifying the request stem can be done using a simple advanced filter. The goal of the advanced filter is to overwrite the value of the request stem field with the request uri field. The request stem filed is simply the name of the script that is called while the request uri field is the name of the script and all variable-value pairs.
Here are the settings for the advanced filter:
Filter name Replace request stem with request uri
Filter Type Advance
Field A request_uri
Extract A (.*)
Field B NONE
Extract B [LEAVE BLANK]
Output To request stem (AUTO)
Constructor $A1
Field A Required YES
Field B Required NO
Override Output Field YES
Case Sensitive NO
Once this filter is set up and applied it will replace the request stem with the request uri so all the reports that are derived from the request stem variable will, essentially, use the request uri variable. This means that rather than looking at just the name of the script the reports will use the name of the script and the variable-value pairs. Looking back at our above example, Urchin reports will now differentiate between:
http://www.foo.com/index.php?p_id=345
http://www.foo.com/index.php?p_id=897
http://www.foo.com/index.php?p_id=456
In your reports you will see the name of the script (the request stem) with the GET variables attached.



