Helicon Ape

mod_usertrack

Overview

mod_usertrack is designed to track users paths through a site using cookies. Each time a page is requested we look to see if the browser is sending us a Cookie: header that we previously generated. If we don’t find one then the user hasn’t been to this site since starting their browser or their browser doesn’t support cookies. So we generate a unique Cookie for the transaction and send it back to the browser (via a “Set-Cookie” header). Future requests from the same browser should keep the same Cookie line. By matching up all the requests with the same cookie you can work out exactly what path a user took through your site. To log the cookie use the “ %{Cookie}n ” directive in a custom access log.

Quick start

Sample mod_usertrack configuration in .htaccess

# enable user tracking
CookieTracking On

# for the following domain
CookieDomain .example.com

# log for the cookies
CustomLog filename "%{Cookie}n \"%r\" %t"

Related articles and topics

Directives

Name Context Description
CookieDomain S V D .h specifies domain name to which the tracking cookie is applied
CookieExpires S V D .h sets expiry time for the tracking cookie
CookieName S V D .h sets the name of tracking cookie
CookieStyle S V D .h defines the format of the cookie header field
CookieTracking S V D .h enables tracking cookie

CookieDomain

CookieDomain directive defines the domain to which tracking cookie will be applied.

Syntax

CookieDomain domain

Description

  • domain is a domain name to which tracking cookie will be applied. If not specified, no domain will be included into the cookie header field. The domain string must begin with a dot and include at least one embedded dot.

Example

CookieDomain .example.com

CookieExpires

CookieExpires directive sets expiry time for the cookie generated by mod_usertrack.

Syntax

CookieExpires expiry-time

Description

  • expiry-time may be set either in seconds.

Example

CookieExpires 3600

or using the following denominations: years, months, weeks, days, hours, minutes and seconds. In this case the expiry-time shall be put in quotes.

Example

CookieExpires "5 weeks 6 days 7 hours"

Note! If this directive is not used, cookies last only for the current browser session.

CookieName

CookieName directive allows to specify custom name for the tracking cookie.

Syntax

CookieName name

Default

CookieName Ape

Description

  • name — custom name for the tracking cookie.

Valid characters for the cookie name are: A-Z, a-z, 0-9, "_", and "-".

Example

CookieName Ape_Tracking_Cookie

CookieStyle

CookieStyle directive defines the format of cookie header field.

Syntax

CookieStyle Netscape|Cookie|Cookie2|RFC2109|RFC2965

Default

CookieStyle Netscape

Description

Three formats are possible:

  • Netscape (default) — original but now obsolete syntax;
  • Cookie or RFC2109 — the syntax that suppressed Netscape syntax;
  • Cookie2 or RFC2965 — the most up-to-date cookie syntax.

Valid characters for the cookie name are: A-Z, a-z, 0-9, "_", and "-".

Example

CookieStyle Cookie

CookieTracking

CookieTracking directive enables mod_usertrack operation and forces it to send a user-tracking cookie for all new requests. This directive may be used to enable/disable user tracking for specific sites/directories.

Syntax

CookieTracking On|Off

Default

CookieTracking Off

Example

CookieTracking On