WP-GoogleStats
WP-GoogleStats is a WordPress plugin that allows you to display when and how often Googlebot crawls your pages.
Installation
Create a new MySQL table as follows (in case, change the wp_ prefix with the table prefix you use in your WP configuration); if you use phpMyAdmin, just select your database, and use the SQL tab to paste this SQL code:
CREATE TABLE `wp_googlestats` ( `page` varchar(100) NOT NULL DEFAULT '', `lastvisit` int(11) NOT NULL DEFAULT '0', `frequency` int(11) NOT NULL DEFAULT '0', `visits` int(11) NOT NULL DEFAULT '0', `timestamp` timestamp(14) NOT NULL, KEY `page` (`page`) )
- Download the plugin and rename it from .phps to .php
- Upload the plugin in your <wordpress-root>/wp-content/plugins/ directory
- Activate the plugin using the WP administrative interface.
Usage
The plugin defines a new template tag called wp_ftr_googlestats(). This function display date and time of the last time Googlebot visited the current page. It takes three optional parameters:
- date_format: format string for the date. Defaults to the date format set in WordPress configuration.
- visited_phrase: text to be displayed before the date. Defaults to ‘Googlebot visited this page ‘.
- never_visited_phrase: text to be displayed if Googlebot never visited the current page. Defaults to ‘Googlebot never visited this page’.
Example
Putting the following code in your template:
<?php if (function_exists ('wp_ftr_googlestats')) wp_ftr_googlestats('l, F j, Y'); ?>
you’ll get something like Googlebot visited this page Friday, September 24, 2004
If you want more control, you can use the wp_ftr_get_googlestats() function. It takes no parameters and returns null if Googlebot never visited the page, or an associative array $results[] with three elements:
- $results[’lastvisit’] the time of the last Googlebot visit expressed as UNIX timestamp (the number of seconds that have elapsed since 1st January 1970).
- $results[’visits’] Number of visits since first plugin activation or last data reset.
- $results[’frequency’] Average frequency of Googlebot visits (in seconds).
Administration
The plugin creates a new Googlebot option in WordPress Manage menu. In this page you can display summary statistics about Googlebot crawls.
Changelog
| Version | Release date | Changes |
| 0.1c | 2005-06-08 | Corrects possible SQL-injection vulnerability |
| 0.1b | 2005-03-16 | First public release |
Copyright
WP-GoogleStats is 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.
