Home : Documentation : Examples : Download
This file is part of The Stickybeak Distribution Package.
New versions of The Stickybeak are occasionally available at: www.stickybeak.com.
Table Of ContentsThere 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 Method | JavaScript + Image | HTML + Image | PHP + Image | Embedded PHP |
Referrer Logging | yes | no | yes | yes |
Cross Domain Tracking | yes | yes | yes | no |
Tracks all activity (including robots like googlebot) | no | no | no | yes |
User Configured Variable Logging | yes | no | yes | yes |
For examples of each of the different methods of installation see the examples.
Table Of Contents$config=array( // 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" => "http://www.example.com/w3c/p3p.xml", // 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 http://www.example.com/w3c/p3p.xml.
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.
Table Of ContentsUse 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_LANGUAGE` tinytext, `HTTP_ACCEPT` text, `QUERY_STRING` tinytext, `SERVER_PROTOCOL` tinytext, `GATEWAY_INTERFACE` 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 '', PRIMARY KEY (`ID`) ) TYPE=MyISAM;
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 ContentsThe 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 ContentsA 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:
CP="NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT"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="http://www.w3.org/2001/09/P3Pv1"> <POLICY-REFERENCES> <POLICY-REF about="/w3c/policy.xml#pixel"> <INCLUDE>/*</INCLUDE> <COOKIE-INCLUDE name="*" value="*" domain="*" path="*"/> </POLICY-REF> </POLICY-REFERENCES> </META>
File policy.xml:
<?xml version="1.0"?> <POLICIES xmlns="http://www.w3.org/2002/01/P3Pv1"> <EXPIRY max-age="86400"/> <POLICY discuri="http://www.stickybeak.com/privacy.html" xml:lang="en" name="pixel"> <ENTITY> <DATA-GROUP> <DATA ref="#business.contact-info.telecom.telephone.number">(+61) 0407 280 127</DATA> <DATA ref="#business.contact-info.online.email">privacy@stickybeak.com</DATA> <DATA ref="#business.contact-info.online.uri">http://www.thestickybeak.com/</DATA> <DATA ref="#business.contact-info.postal.organization">The Stickybeak</DATA> <DATA ref="#business.contact-info.postal.street">PO Box 985</DATA> <DATA ref="#business.contact-info.postal.city">Newcastle</DATA> <DATA ref="#business.contact-info.postal.stateprov">NSW</DATA> <DATA ref="#business.contact-info.postal.postalcode">2300</DATA> <DATA ref="#business.contact-info.postal.country">Australia</DATA> <DATA ref="#business.name">The Stickybeak</DATA> </DATA-GROUP> </ENTITY> <ACCESS><nonident/></ACCESS> <STATEMENT> <EXTENSION optional="yes"> <GROUP-INFO xmlns="http://www.software.ibm.com/P3P/editor/extension-1.0.html" name="Basic information"/> </EXTENSION> <CONSEQUENCE> Data collected from all Web users: access logs, and search strings (if entered). </CONSEQUENCE> <PURPOSE><admin/><current/><develop/></PURPOSE> <RECIPIENT><ours/></RECIPIENT> <RETENTION><indefinitely/></RETENTION> <DATA-GROUP> <DATA ref="#dynamic.clickstream"/> <DATA ref="#dynamic.http"/> <DATA ref="#dynamic.searchtext"/> </DATA-GROUP> </STATEMENT> <STATEMENT> <EXTENSION optional="yes"> <GROUP-INFO xmlns="http://www.software.ibm.com/P3P/editor/extension-1.0.html" name="Cookies"/> </EXTENSION> <CONSEQUENCE> Cookies are used to track visitors to our site, so we can better understand what portions of our site best serve you. </CONSEQUENCE> <PURPOSE><develop/><tailoring/></PURPOSE> <RECIPIENT><ours/></RECIPIENT> <RETENTION><business-practices/></RETENTION> <DATA-GROUP> <DATA ref="#dynamic.cookies" optional="yes"><CATEGORIES><uniqueid/></CATEGORIES></DATA> </DATA-GROUP> </STATEMENT> </POLICY> </POLICIES>For more information about P3P see:
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