WP-GoogleStats

WP-GoogleStats is a WordPress plugin that allows you to display when and how often Googlebot crawls your pages.

WP-GoogleStats is a WordPress plugin that allows you to display when and how often Googlebot crawls your pages.

Installation

  • Download the plugin
  • Upload the plugin in your <wordpress-root>/wp-content/plugins/ directory
  • Activate the plugin using the WP administrative interface. This operation will create a new table in the WordPress database called table_prefix:googlestats (the table prefix is defined in wp-config.php)

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.1e 2010-05-27 Automatically creates the googlestats table at the first plugin activation
0.1d 2010-05-25 Use $capability instead of the deprecated $user_level
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.

Copyright © Fabrizio Tarizzo

This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Italy License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/it/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.