JKL Toy Company enables cookie tracking on HTTP Server
This scenario discusses how to enable cookie tracking for an IBM® HTTP Server for i Web server.
Scenario
The JKL Toy Company (a fictitious company) wants to be able to measure Web site visitor activity and trends. The JKL Web administrator would like to try to measure how many new and unique users visit the intranet Web site. Requiring users to obtain a userid and password is the most accurate way track users; however, this method has the disadvantage of forcing the intranet Web users to register for a userid and password.
- Some ISPs use dynamic IP addressing, assigning random IP addresses to all users.
- Some ISPs send all traffic through a proxy server, creating a log entry for the IP address of the proxy server only.
Setting a unique number in a cookie in the user's browser the first time that they visit the Web site combined with using a log that records cookies could be used to track users. This log can be analyzed to show how many new cookies have been set and how many old cookies have returned. In addition, the log can also be used to show the sequence of URLs that a particular cookie used to navigate through the Web site. A downside of this method is that users can shut off the browsers ability to record cookies.
The JKL Web administrator has decided to use the cookie method. The JKL Web administrator will store cookie information in a new log called JKLCOOKIE_LOG using a new cookie called JKLCOOKIE.
Prerequisites
- It is assumed you have read Scenarios: HTTP Server.
- It is assumed you have read and completed JKL Toy Company creates an HTTP Server or you have an existing HTTP Server configuration.
Start the IBM Web Administration for i interface
Access the IBM Web Administration for i from your browser. For information about how to access the Web Administration for i interface, see Starting Web Administration for i.
Create a cookie for HTTP Server
- Click the Manage tab.
- Click the HTTP Servers subtab.
- Select your HTTP Server from the Server list.
Example: JKLTEST
- Select Global configuration from the Server area list.
- Expand Server Properties.
- Click Logging.
- Click the User Tracking (Cookies) tab in the form.
- Select Enabled from the Track user requests in a cookie list.
- Enter a name for the cookie in the Cookie name field or
use the default.
Example: JKLCOOKIE
- Enter a value in the Expiration period field.
Example: 1
- Select a time period from the Expiration period list.
Example: Years
- Click OK.
Set up the cookie log for HTTP Server
- Click the Manage tab.
- Click the HTTP Servers subtab.
- Select Global configuration from the Server area list.
- Expand Server Properties.
- Click Logging.
- Click the Custom Logs tab in the form.
- Click Add under the Custom logs table.
- Enter logs/[log_name] in the Log column.
Example: logs/jklcookie_log
- Select cookie from the Log format list.
- Enter a value in the Expiration field.
Example: 364
- Select a time period from the Expiration list.
Example: Days
- Click Continue.
- Click OK.
Restart your HTTP Server
Select one of the following methods below:
Manage one server
- Click the Manage tab.
- Click the HTTP Servers subtab.
- Select your HTTP Server from the Server list.
- Click the Stop icon if the server is running.
- Click the Start icon.
Manage all servers
- Click the Manage tab.
- Click the HTTP Servers subtab.
- Select All Servers from the Server list.
- Click the All HTTP Servers tab.
- Select your HTTP Server name in the table.
Example: JKLTEST
- Click Stop if the server is running.
- Click Start.
Test your HTTP Server
- Open a new Web browser.
- Turn cookie alerts on in your browser. Consult the Web browser's help documentation for details on enabling cookie alerts.
- Enter http://[i_hostname]:[port] in the location or URL
field.
Example: http://jkl_server:1975
View your HTTP Server configuration
Your configuration will look similar if you used the given example in this and previous examples.
- Click the Manage tab.
- Click the HTTP Servers subtab.
- Select your HTTP Server from the Server list.
Example: JKLTEST
- Expand Tools.
- Click Display Configuration File.
Listen *:1975
DocumentRoot /www/jkltest/htdocs
TraceEnable Off
Options -FollowSymLinks
LogMaint logs/jklcookie_log 364 0
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{Cookie}n \"%r\" %t" cookie
LogFormat "%{User-agent}i" agent
LogFormat "%{Referer}i -> %U" referer
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access_log combined
CustomLog logs/jklcookie_log cookie
LogMaint logs/access_log 7 0
LogMaint logs/error_log 7 0
SetEnvIf "User-Agent" "Mozilla/2" nokeepalive
SetEnvIf "User-Agent" "JDK/1\.0" force-response-1.0
SetEnvIf "User-Agent" "Java/1\.0" force-response-1.0
SetEnvIf "User-Agent" "RealPlayer 4\.0" force-response-1.0
SetEnvIf "User-Agent" "MSIE 4\.0b2;" nokeepalive
SetEnvIf "User-Agent" "MSIE 4\.0b2;" force-response-1.0
CookieTracking On
CookieName JKLCOOKIE
CookieExpires 31536000
<Directory />
Require all denied
</Directory>
<Directory /www/jkltest/htdocs>
Require all granted
</Directory>