Skip to content

Commit db5deb1

Browse files
deeper analytics
1 parent 63e01e9 commit db5deb1

File tree

3 files changed

+62
-3
lines changed

3 files changed

+62
-3
lines changed

cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# version 230
2+
# version 231
33

44
# gogole maps files
55
http://maps.google.com/maps/api/js?v=3.10&sensor=false&language=en_us&key=AIzaSyCOqkcNey4CCyG4X0X5qxHAhCgD8g5DwXg

js/app.js

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ for(var idx in params) {
3737
}
3838
}
3939

40+
if(embed.enabled) {
41+
//analytics
42+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Embed Opts', window.location.search]);
43+
}
44+
4045
$.ajaxSetup({ cache: true });
4146

4247
// handle cachin events and display a loading bar
@@ -210,6 +215,8 @@ var positionUpdateHandle = function(position) {
210215
if(CHASE_enabled) {
211216
ChaseCar.updatePosition(callsign, position);
212217
CHASE_timer = (new Date()).getTime() + 15000;
218+
219+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'upload', 'chase car position']);
213220
}
214221
}
215222
else { return; }
@@ -256,9 +263,15 @@ $(window).ready(function() {
256263
if(e.hasClass('active')) {
257264
e.removeClass('active');
258265
var h = $('#map').height() + $('#telemetry_graph').height();
266+
267+
//analytics
268+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI', 'Telemetry Graph', 'Collapse']);
259269
} else {
260270
e.addClass('active');
261271
var h = $('#map').height() - $('#telemetry_graph').height();
272+
273+
//analytics
274+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI', 'Telemetry Graph', 'Expand']);
262275
}
263276
$('#map').stop(null,null).animate({'height': h}, function() {
264277
if(map) google.maps.event.trigger(map, 'resize');
@@ -277,7 +290,12 @@ $(window).ready(function() {
277290

278291
// confirm dialog when launchnig a native map app with coordinates
279292
$('#main').on('click', '#launch_mapapp', function() {
280-
return confirm("Launch your maps app?");
293+
var answer = confirm("Launch your maps app?");
294+
295+
//analytics
296+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Coord Click', ((answer)?"Yes":"No")]);
297+
298+
return answer;
281299
});
282300

283301
// follow vehicle by clicking on data
@@ -331,6 +349,9 @@ $(window).ready(function() {
331349
if(box.is(':hidden')) {
332350
$('#chasecarbox,#aboutbox,#settingsbox,#embedbox').hide();
333351
box.show();
352+
353+
// analytics
354+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open', 'Map']);
334355
}
335356
checkSize();
336357
})
@@ -340,6 +361,9 @@ $(window).ready(function() {
340361
if(box.is(':hidden')) {
341362
$('.main_screen,#aboutbox,#settingsbox,#embedbox').hide();
342363
box.show().scrollTop(0);
364+
365+
// analytics
366+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open', 'Chase Car']);
343367
}
344368
checkSize();
345369
})
@@ -349,6 +373,9 @@ $(window).ready(function() {
349373
if(box.is(':hidden')) {
350374
$('.main_screen,#chasecarbox,#settingsbox,#embedbox').hide();
351375
box.show().scrollTop(0);
376+
377+
// analytics
378+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open', 'About']);
352379
}
353380
checkSize();
354381
})
@@ -358,6 +385,9 @@ $(window).ready(function() {
358385
if(box.is(':hidden')) {
359386
$('.main_screen,#chasecarbox,#aboutbox,#embedbox').hide();
360387
box.show().scrollTop(0);
388+
389+
// analytics
390+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open', 'Settings']);
361391
}
362392
})
363393
.on('click', '.embed', function() {
@@ -366,6 +396,9 @@ $(window).ready(function() {
366396
if(box.is(':hidden')) {
367397
$('.main_screen,#chasecarbox,#aboutbox,#settingsbox').hide();
368398
box.show().scrollTop(0);
399+
400+
// analytics
401+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'UI Menubar', 'Open', 'Embed']);
369402
}
370403
checkSize();
371404
});
@@ -386,6 +419,9 @@ $(window).ready(function() {
386419

387420
// blue man reappers :)
388421
if(currentPosition && currentPosition.marker) currentPosition.marker.setVisible(true);
422+
423+
// analytics
424+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Chase Car', 'Off']);
389425
// turning the switch on
390426
} else {
391427
if(callsign.length < 5) { alert('Please enter a valid callsign, at least 5 characters'); return; }
@@ -406,13 +442,17 @@ $(window).ready(function() {
406442
// if already have a position push it to habitat
407443
if(GPS_ts) {
408444
ChaseCar.updatePosition(callsign, { coords: { latitude: GPS_lat, longitude: GPS_lon, altitude: GPS_alt, speed: GPS_speed }});
445+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'upload', 'chase car position']);
409446
}
410447

411448
if(navigator.geolocation) CHASE_enabled = navigator.geolocation.watchPosition(positionUpdateHandle, positionUpdateError);
412449
//CHASE_enabled = true;
413450

414451
// hide the blue man
415452
if(currentPosition && currentPosition.marker) currentPosition.marker.setVisible(false);
453+
454+
// analytics
455+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Chase Car', 'On']);
416456
}
417457
});
418458

@@ -439,10 +479,16 @@ $(window).ready(function() {
439479
e.removeClass('on').addClass('off');
440480
on = 0;
441481
nite.hide();
482+
483+
//analytics
484+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Nite Overlay', 'Off']);
442485
} else {
443486
e.removeClass('off').addClass('on');
444487
on = 1;
445488
nite.show();
489+
490+
//analytics
491+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Nite Overlay', 'On']);
446492
}
447493

448494
offline.set(name, on);
@@ -459,9 +505,15 @@ $(window).ready(function() {
459505
if(e.hasClass('on')) {
460506
e.removeClass('on').addClass('off');
461507
on = 0;
508+
509+
//analytics
510+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', name, 'Off']);
462511
} else {
463512
e.removeClass('off').addClass('on');
464513
on = 1;
514+
515+
//analytics
516+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', name, 'On']);
465517
}
466518

467519
offline.set(name, on);
@@ -501,6 +553,9 @@ $(window).ready(function() {
501553
$('.nav .home').click();
502554
// pan map to our current location
503555
map.panTo(new google.maps.LatLng(currentPosition.lat, currentPosition.lon));
556+
557+
//analytics
558+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Locate me']);
504559
} else {
505560
alert("No position available");
506561
}

js/tracker.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ function refresh() {
965965
//status = '<img src="spinner.gif" width="16" height="16" alt="" /> Refreshing ...';
966966
//$('#status_bar').html(status);
967967

968-
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'ajax', 'refresh']);
968+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'ajax', 'refresh', 'Vehicles']);
969969

970970
$.ajax({
971971
type: "GET",
@@ -985,6 +985,8 @@ function refresh() {
985985
}
986986

987987
function refreshReceivers() {
988+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'ajax', 'refresh', 'Recievers']);
989+
988990
$.ajax({
989991
type: "GET",
990992
url: receivers_url,
@@ -1004,6 +1006,8 @@ function refreshReceivers() {
10041006
}
10051007

10061008
function refreshPredictions() {
1009+
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'ajax', 'refresh', 'Predictions']);
1010+
10071011
$.ajax({
10081012
type: "GET",
10091013
url: predictions_url,

0 commit comments

Comments
 (0)