The purpose of this tutorial is to show how to create a realtime location aware visitor tracker for a web site or application.
When a visitor navigates to the page on your site, or accesses your mobile web app, the visitor tracker will display the new visitor hit in realtime, displaying the page they've landed on and where each visitor is on a Google map (lat/long and locality). For the purposes of the tutorial, we'll write our server code in PHP, but you could use any server side language you like.
Here is how the end result will look like:
Here's the order in which we'll cover things:
- Get the basics out of the way
- Connect to Pusher
- Subscribe to new visitor page hits notifications
- Get the visitor's location using the HTML5 Geolocation API
- Broadcast the visitor location and page to all application visitors using Pusher
- Display the visitor location and page information on a Google map
Compatibility: All Modern Browsers