If you want to do page counting and analysis there are several MySql tables that you can use. The MySql schema for these tables is in the mysql.schema file in the repository.
The tables are:
Here are the schemas of the tables:
CREATE TABLE `bots` (
varchar(40) NOT NULL DEFAULT '',
`ip` varchar(255) NOT NULL DEFAULT '',
`agent` int(11) DEFAULT NULL,
`count` int(5) DEFAULT '0',
`robots` varchar(255) DEFAULT NULL,
`who` DEFAULT NULL,
`creation_time` datetime DEFAULT NULL,
`lasttime` datetime PRIMARY KEY (`ip`,`agent`),
KEY `ip` (`ip`)
=MyISAM DEFAULT CHARSET=utf8;
) ENGINE
CREATE TABLE `bots2` (
varchar(40) NOT NULL DEFAULT '',
`ip` varchar(255) NOT NULL DEFAULT '',
`agent` date NOT NULL DEFAULT '0000-00-00',
`date` varchar(50) NOT NULL DEFAULT '',
`site` int(5) NOT NULL DEFAULT '0',
`which` int(11) DEFAULT NULL,
`count` DEFAULT NULL,
`lasttime` datetime PRIMARY KEY (`ip`,`agent`,`date`,`site`,`which`),
KEY `ip` (`ip`),
KEY `agent` (`agent`),
KEY `site` (`site`),
KEY `ip_2` (`ip`),
KEY `date` (`date`),
KEY `site_2` (`site`)
=InnoDB DEFAULT CHARSET=utf8;
) ENGINE
CREATE TABLE `logagent` (
varchar(25) NOT NULL DEFAULT '',
`site` varchar(40) NOT NULL DEFAULT '',
`ip` varchar(255) NOT NULL,
`agent` int(11) DEFAULT NULL,
`count` int(11) DEFAULT NULL,
`id` DEFAULT '0000-00-00 00:00:00',
`created` datetime DEFAULT NULL,
`lasttime` datetime PRIMARY KEY (`site`,`ip`,`agent`),
KEY `ip` (`ip`),
KEY `site` (`site`),
KEY `agent` (`agent`)
=MyISAM DEFAULT CHARSET=utf8;
) ENGINE
CREATE TABLE `logagent2` (
varchar(25) NOT NULL DEFAULT '',
`site` varchar(40) NOT NULL DEFAULT '',
`ip` varchar(255) NOT NULL,
`agent` int(11) DEFAULT NULL,
`count` int(11) DEFAULT NULL,
`id` DEFAULT '0000-00-00 00:00:00',
`created` datetime DEFAULT NULL,
`lasttime` datetime PRIMARY KEY (`site`,`ip`,`agent`),
KEY `agent` (`agent`),
KEY `site` (`site`),
KEY `ip` (`ip`)
=MyISAM DEFAULT CHARSET=utf8;
) ENGINE
CREATE TABLE `daycounts` (
varchar(50) NOT NULL DEFAULT '',
`site` date NOT NULL,
`date` int(11) DEFAULT '0',
`real` int(11) DEFAULT '0',
`bots` int(11) DEFAULT '0',
`members` int(11) DEFAULT NULL,
`visits` DEFAULT NULL,
`lasttime` datetime PRIMARY KEY (`site`,`date`)
=MyISAM DEFAULT CHARSET=utf8;
) ENGINE
CREATE TABLE `counter` (
varchar(255) NOT NULL,
`filename` varchar(50) NOT NULL DEFAULT '',
`site` varchar(20) DEFAULT NULL,
`ip` varchar(255) DEFAULT NULL,
`agent` int(11) DEFAULT NULL,
`count` int(11) DEFAULT '0',
`realcnt` DEFAULT NULL,
`lasttime` datetime PRIMARY KEY (`filename`,`site`),
KEY `site` (`site`)
=MyISAM DEFAULT CHARSET=utf8;
) ENGINE
CREATE TABLE `counter2` (
varchar(50) NOT NULL DEFAULT '',
`site` date NOT NULL DEFAULT '0000-00-00',
`date` varchar(255) NOT NULL DEFAULT '',
`filename` int(11) DEFAULT '0',
`count` int(11) DEFAULT '0',
`members` int(11) DEFAULT '0',
`bots` DEFAULT NULL,
`lasttime` datetime PRIMARY KEY (`site`,`date`,`filename`),
KEY `site` (`site`),
KEY `date` (`date`)
=MyISAM DEFAULT CHARSET=utf8;
) ENGINE
CREATE TABLE `tracker` (
int(11) NOT NULL AUTO_INCREMENT,
`id` varchar(25) DEFAULT NULL,
`site` varchar(255) NOT NULL DEFAULT '',
`page` varchar(40) DEFAULT NULL,
`ip` varchar(255) DEFAULT NULL,
`agent` DEFAULT NULL,
`starttime` datetime DEFAULT NULL,
`endtime` datetime time DEFAULT NULL,
`difftime` int(11) DEFAULT '0',
`refid` int(5) DEFAULT '0',
`isJavaScript` DEFAULT NULL,
`lasttime` datetime PRIMARY KEY (`id`),
KEY `site` (`site`),
KEY `ip` (`ip`),
KEY `agent` (`agent`)
=MyISAM DEFAULT CHARSET=utf8; ) ENGINE
If you look at dbAbstract you will see several methods in the constructor:
If you look at these methods you will see that they are protected by a check of the database to see if the tables exists in the database. If the table does not exist an 'error_log' message is output. You can prevent the error message by setting "noErrorLog": "true" in the 'mysitemap.json' file.
I have five additional PHP files to check robots.txt (robots.php) and Sitemap.xml (sitemap.php). I also have a 'tracker.php', 'beacon.php' and 'tracker.js' to do session logging. These file are here in the 'docs/' directory.
If you want to track reads of robots.txt and Sitemap.xml you can add 'RewriteRule' clauses to your '.htaccess' file:
# Direct robots.txt to robots.php and Sitemap.xml to sitemap.php
# Also csstest-nnnnn.css redirects to our tracker.php
RewriteRule ^robots\.txt$ robots.php [L,NC]
RewriteRule ^Sitemap\.xml$ sitemap.php [L,NC]
RewriteRule ^csstest-(.*)\.css$ https://bartonlp.com/otherpages/tracker.php?id=$1&page=csstest [L,QSA]
!!!!NEEDS UPDATING!!!!
Examples
dbTables
SiteClass Methods
Additional Files
Analysis and Tracking
Index
Barton Phillips : bartonphillips@gmail.com
Copyright © 2024 Barton Phillips
Project maintained by bartonlp
Last Modified January 5, 2024