WP/GeoTrack Wordpress Plugin Copyright (C) 2006 Johannes Lietz http://dadabase.de/weblog/archives/2006/05/23/wordpress-geotrack-plugin ================================================================================ LICENSE ================================================================================ This program is postcardware, which means you can redistribute it and/or modify it, but if you like it, I would be pleased if you send mit a physical snail mail (kind of oldschool geotracking ;-)) postcard to: Johannes Lietz Kopernikusstr. 94 D-40225 Duesseldorf Germany 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. Uses MaxMind GeoLite City, http://www.maxmind.com/app/geolitecity Copyright (C) 2004 Maxmind LLC which is licenced under the GNU Lesser General Public License. ================================================================================ THE PLUGIN FEATURES ================================================================================ - logs every visit on your wordpress blog in your MySQL database - contains the same information as Apache combined server logs with ip, referrer, method, status, uri, user agent and access time - additionally stores geo-ip information with country, ISO country code, city name, latitude and longitude - displays a list of current visitors - displays a top-10-list of referrers, visited pages, visitors' countries and visitors' cities - has functionality to prevent referrer spamming - ip blocking of referrer spammers - contains a set free (GNU-GPL / Creative Commons) country flags from Wikipedia - Google maps integration: shows your visitors' locations on world map - fast geoip retrieval through local database - contains installer and update scripts - uses MaxMind GeoLite City - example page: http://dadabase.de/weblog/einflugschneise/ ================================================================================ INSTALLATION ================================================================================ To install the WP/Geotracking-Plugin, follow these steps: ================================================================================ 1. Install the files ================================================================================ If you have commandline access to your server, login to the shell and enter the following commands: $ cd /path_to_your_wordpress_installation/wp-content/plugins/ $ wget http://dadabase.de/weblog/wp-content/wp_geotrack.zip $ unzip wp_geotrack.zip If you don't have commandline access to your server or don't even know that it is, don't worry: - download http://dadabase.de/weblog/wp-content/wp_geotrack.zip to your computer - unzip the wp_geotrack.zip archive with your favotite zip-application, e.g. WinZip, FilZip or whatever - open your FTP-Client and go to your Wordpress-directory - go to wp-content/plugins - upload the file wp_geotrack.php and the folder wp_geotrack into the plugins directory The directory structure should look like this: + + wp-content + plugins + wp_geotrack.php + wp_geotrack + ================================================================================ 2. Activate the plugin ================================================================================ Go to your Wordpress admin's plugin page (e.g. http://www.example.com/wordpress/wp-admin/plugins.php) and activate the plugin. ================================================================================ 4. Get your Google map key ================================================================================ If you want to use the Google map, you will have to get your own map key at: http://www.google.de/apis/maps/signup.html (Google Account required) ================================================================================ 3. Configure the plugin ================================================================================ In your wordpress admin go to Options -> WP-Geotrack Plugin - on the bottom of the page click "Install/Update MySQL Database Tables" - click "Install/Update Geo-IP Database". This will download and unpack a new copy of the MaxMind geo-database. This will take some time, so please be patient untill it is finished - set the plugins options (e.g. Google map key) and click "Update options" ================================================================================ 4. Use the plugin ================================================================================ You have two options to use the plugin: 1. Create a new page (or post) in Wordpress, and enter the following tags into that page: - [wp-geotrack-list] will display a list of recent visitors of your blog - [wp-geotrack-googlemap] will display a Google Map and highlight the recent visitors of you blog - [wp-geotrack-topsites] will display a list of your most visited pages - [wp-geotrack-topreferrers] will display a list of referring sites 2. Use the following functions directly in a templatte: echo wp_geotrack_display(); echo wp_geotrack_googlemap(); echo wp_geotrack_topsites(); echo wp_geotrack_topreferrers(); 3. The $_SESSION ist filled with all available user details. E.g. you can use to display the user's country in your blog. You can get: - country - country_code (2-letter ISO code) - city - latitude - longitude - uri (the current uri) - referrer (if any) ================================================================================ SYSTEM REQUIREMENTS ================================================================================ This plugin has been tested with PHP4, PHP5, Wordpress 2.0.x - 2.1, MySQL 4 - 5 ================================================================================ MAINTANANCE ================================================================================ The MaxMind database is updated by MaxMind once per month on every first day. You might want to update yours sometimes. ================================================================================ RESIZE THE FLAGS ================================================================================ If you want to resize the country flags, you can use the script under wp_geotrack/flags/src/convert.sh to do so. Requires ImageMagick. ================================================================================ KNOWN ISSUES ================================================================================ The XHTML the plugin produces is not really valid, as Wordpress applies some formatting after the plugin output is produced. To fix this, we would have to patch Wordpress itself. ================================================================================ SUPPORT ================================================================================ Feel free to write an e-mail to: Johannes Lietz Have Fun! :-)