The Stickybeak

Home : Documentation : Examples : Download


This file is part of The Stickybeak Distribution Package.

Table of Contents


New versions of The Stickybeak are occasionally available at:

Table Of Contents


There are several different ways to call The Stickybeak from your web pages. Each method needs a different kind of code snippet which must be added to your web pages. The Stickybeak Code Generator can be used to create these snippets, alternately javascript or PHP may be used to generate the code to include the logging image. The Stickybeak may also be called directly from existing PHP code without the need for image based logging. The table below summarizes the characteristics of different methods of invoking the logger:

Calling MethodJavaScript + ImageHTML + ImagePHP + ImageEmbedded PHP
Referrer Loggingyesnoyesyes
Cross Domain Trackingyesyesyesno
Tracks all activity (including robots like googlebot)nononoyes
User Configured Variable Loggingyesnoyesyes

For examples of each of the different methods of installation see the examples.

Table Of Contents

Configuring The Stickybeak

Database Connection Parameters

Cookie parameters

P3P Policy Location

Image Configuration

Table Of Contents

Example Configuration File


 // Database Connection Parameters
   "mysqlhost" => "localhost", 
   "mysqldb" => "stickybeak", 
   "mysqltable" => "stickybeak_logs",    
   "mysqluser" => "stickybeak_username", 
   "mysqlpass" => "stickybeak_password", 
 // cookie parameters
   "usecookie" => true, 
   "cookiename" => "ID",  
   "cookienumchars" => 16, 
   "cookiealphabet" => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",  
 // location of p3p policy ... required for cross domain tracking  
   "p3pURL" => "",

 // image information
   "image" => "TheStickybeak.png", 
   "imagetype" => "png", 
   "pixel" => false


The above configuration file will log table stickybeak_logs in database stickybeak on server localhost. The Stickybeak will connect to the database as user stickybeak_username and password stickybeak_password.

A cookie named ID will be set with a value 16 characters long comprising of a combination of all the upper and lower case letters and the numbers 0-10. The cookie will refer to a P3P Policy at

An image in PNG format will be generated using the seed file TheStickybeak.png. This image can be displayed as part of an HTML page while also logging user activity.

More Configuration Examples.

Table Of Contents

Log Structure

Use the following code to create one or more tables in your MySQL database. This code is contained in The Stickybeak distribution file as TheSTickybeak.sql

 CREATE TABLE `stickybeak_logs` (
  `ID` int(11) NOT NULL auto_increment,
  `sessionID` varchar(32) NOT NULL default '',
  `LOGYEAR` smallint(6) NOT NULL default '0',
  `LOGMONTH` tinyint(6) NOT NULL default '0',
  `LOGDAY` tinyint(4) NOT NULL default '0',
  `LOGHOUR` tinyint(4) NOT NULL default '0',
  `LOGMINUTE` tinyint(4) NOT NULL default '0',
  `LOGSECOND` tinyint(4) NOT NULL default '0',
  `REMOTE_ADDR` varchar(15) NOT NULL default '',
  `HTTP_REFERER` tinytext,
  `REQUEST_METHOD` varchar(15) default NULL,
  `unixtime` int(11) NOT NULL default '0',
  `mysqltime` datetime NOT NULL default '0000-00-00 00:00:00',
  `HTTP_USER_AGENT` tinytext,
  `REMOTE_PORT` smallint(9) default NULL,
  `SCRIPT_NAME` tinytext,
  `HTTP_CONNECTION` tinytext,
  `HTTP_ACCEPT` text,
  `QUERY_STRING` tinytext,
  `SERVER_PROTOCOL` tinytext,
  `REMOTE_HOST_NAME` tinytext,
  `DOCUMENT_URL` varchar(255) NOT NULL default '',
  `HTTP_HOST` varchar(255) NOT NULL default '',
  `REQUEST_URI` varchar(255) NOT NULL default '',
  `page` varchar(32) NOT NULL default '',
  `identifier` varchar(32) NOT NULL default '',

It is possible to log to many seperate database tables using a single installation of The Stickybeak. In order to create additional log tables change the table name on line 1 of the above code from stickybeak_logs to something else and re-execute the SQL.

Table Of Contents

Cross Domain Tracking

The Stickybeak uses cookies to track users. Cookies can only be read by the pages on the domain name from which they were set. As a result of this it is difficult to continue to identify a user as their web browsing takes them from one domain to another

The Stickybeak uses images by default for logging. The image file may be called from a remote server, such that the location of the logging mechanism need not be on the same server as the webpage being logged. Many different sites on different domains and servers may be tracked using a single image. Because the image is always called from the same server regardless of the location of the page being logged, the same cookie can be used for all sites calling the image.

Table Of Contents

Platform for Privacy Preferences (P3P)

A P3P policy or Compact Privacy Policy is a way of announcing to a browser particular ccharacteristics of a sites privacy policy. It allows the user to make predertmined choices about allowing or disallowing cookies based on the announced characteristics. P3P is based on established W3C specifications, which include HTTP, Extensible Markup Language (XML) and Resource Description Format (RDF).

Microsoft's Internet Explorer 6.0 (IE6) and Windows XP contains new privacy features based on the specifications of the Platform for Privacy Preferences Project (P3P). The default settings in IE6 block cookies that are set from domains other than that hosting the requested page. The Stickybeak relies on the ability to be able to set cookies from an image that may be hosted on another domain. IE6 will accept cookies from an external domain if an appropriate P3P policy is in place on the site that sets the cookies. At time of writing Internet Explorer 6 was by far the most used browsers. It is likely that other browsers will incorporate p3p technology into their architecture.

For example the compact policy which corresponds to this document is:


This compact policy is sent by the Web server along with the cookies it describes. The following table explains the meaning of each field in the compact policy.

For example, the P3P policy for this site contains 2 files, p3p.xml and policy.xml.

File p3p.xml:

<META xmlns="">
  <POLICY-REF about="/w3c/policy.xml#pixel">
   <COOKIE-INCLUDE name="*" value="*" domain="*" path="*"/>

File policy.xml:

<?xml version="1.0"?>
<POLICIES xmlns="">
  <EXPIRY max-age="86400"/>
    <DATA ref="">(+61) 0407 280 127</DATA>
    <DATA ref=""></DATA>
    <DATA ref=""></DATA>
    <DATA ref="">The Stickybeak</DATA>
    <DATA ref="">PO Box 985</DATA>
    <DATA ref="">Newcastle</DATA>
    <DATA ref="">NSW</DATA>
    <DATA ref="">2300</DATA>
    <DATA ref="">Australia</DATA>
    <DATA ref="">The Stickybeak</DATA>
        <EXTENSION optional="yes">
                name="Basic information"/>
        Data collected from all Web users: access logs, and search strings (if entered).
    <DATA ref="#dynamic.clickstream"/>
    <DATA ref="#dynamic.http"/>
    <DATA ref="#dynamic.searchtext"/>
        <EXTENSION optional="yes">
        Cookies are used to track visitors to our site, 
        so we can better understand what portions of our site best serve you.
    <DATA ref="#dynamic.cookies" optional="yes"><CATEGORIES><uniqueid/></CATEGORIES></DATA>

For more information about P3P see:
Table Of Contents


The Stickybeak is available as free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA to request a copy.

Table Of Contents

The Stickybeak Powered by PHP Powered by MySQL

© 2001-2017