Textpattern Logs and Google Maps

As I’ve never been one to miss out on a web development fad Google Maps has always been intriguing to me. Combine that with a bad habit of being a web stats junky and you get a new Textpattern plugin.

I had previously been pleased to find GVisit, a service that uses a javascript on you site to log hits and plot them on a map. Unfortunately, my use of that service was short lived because it caused page loading to slow down quite a bit.

The rss_googlemap_stats plugin is my Textpattern replacement for GVisit.

How It Works

The plugin queries your Textpattern log table for the most recent visitors IP addresses, locates them using an IP Address Lookup service and then plots them out on a map using the Phoogle Maps PHP class.

See it in action

Before You Start

First, make sure login is turned on in Textpattern. Then, go out and get a Google Maps API Key. Its free, and you need a unique key for each domain you use the plugin on.

Next, setup a writable directory for the plugin to cache IP lookups in. Finally, install and activate the plugin, and add the appropriate plugin calls to you page.

Some Final Notes

  • The cache has been implemented for performance reasons. From my testing, 25 seems like a reasonable number of IPs to lookup. As you increase to limit, you’ll notice a slow down in loading time.
  • Loading time is also affected by communication with Google to build the map. If Google’s severs are slow, your site will be too.
  • The locations in the chart below the map are clickable and will activate the popup over the associated map point.
  • This really doesn’t do anything more exciting than this but it was fun to play with Google Maps.

Comments

23. January 2006

That’s just cool.

Add a comment

You may use textile in your comment. Gravatars are enabled. Your email will not be displayed and will remain private. I reserve the right to edit or delete comments.





Textpattern Solutions

Textpattern Solutions

Textpattern Solutions is the first book published on Textpattern.

details at friends of ED or the official book website.

buy it at amazon.com