Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding info window, page location and updating README

  • Loading branch information...
commit 121e273d1633b6ce4c18ea0771c69b88a74048e7 1 parent 1e7c3fc
@leggetter leggetter authored
Showing with 24 additions and 4 deletions.
  1. +10 −3 README.md
  2. +12 −0 src/js/tracker.js
  3. +2 −1  src/pusher/new_hit.php
View
13 README.md
@@ -1,4 +1,11 @@
-realtime-visitor-tracker
-========================
+# Realtime Visitor Tracker
-Realtime location aware visitor tracker for a web site or application
+Realtime location aware visitor tracker for a web site or application.
+
+## Tutorial
+
+**Coming soon...**
+
+## Demo
+
+http://www.leggetter.co.uk/pusher/realtime-visitor-tracker/
View
12 src/js/tracker.js
@@ -30,6 +30,18 @@
map: map,
animation: google.maps.Animation.DROP
});
+
+ var contentString = '' +
+ '<div class="visitor-info">' +
+ '<strong>Locality:</strong> ' + data.locality + '<br />' +
+ '<strong>Lat/Lng:</strong> ' + data.lat + ', ' + data.lng + '<br />' +
+ '<strong>Page:</strong> <a href="' + data.page + '">' + data.page.replace(/https?:\/\/[^/]*/, '') + '</a><br />' +
+ '</div>';
+
+ var infowindow = new google.maps.InfoWindow({content: contentString});
+ google.maps.event.addListener(styleMaker, 'click', function() {
+ infowindow.open(map, styleMaker);
+ });
}
var visitorPosition = null;
View
3  src/pusher/new_hit.php
@@ -5,7 +5,8 @@
$data = array(
'lat' => $_POST['lat'],
'lng' => $_POST['lng'],
- 'locality' => $_POST['locality']
+ 'locality' => $_POST['locality'],
+ 'page' => $_SERVER['HTTP_REFERER']
);
$pusher = new Pusher(APP_KEY, APP_SECRET, APP_ID);
Please sign in to comment.
Something went wrong with that request. Please try again.