* VRFS-709 - track client downloads

This commit is contained in:
Seth Call 2013-09-23 21:32:37 +00:00
parent 3c69988d1d
commit 9c426fc5a7
4 changed files with 33 additions and 3 deletions

View File

@ -1,6 +1,7 @@
//= require jquery
//= require jquery.queryparams
//= require AAC_underscore
//= require globals
//= require jamkazam
//= require utils
//= require ga

View File

@ -15,7 +15,22 @@
}
var categories = {
register : "Register"
register : "Register",
download : "DownloadClient"
}
function translatePlatformForGA(platform) {
assertOneOf(platform, context.JK.OS);
if(platform == context.JK.OS.WIN32) {
return "Windows";
}
if(platform == context.JK.OS.OSX) {
return "Mac";
}
if(platform == context.JK.OS.UNIX) {
return "Unix";
}
}
function assertBoolean(value) {
@ -46,8 +61,15 @@
ga('send', 'event', categories.register, action, registrationType);
}
function trackDownload(platform) {
var normalizedPlatform = translatePlatformForGA(platform);
ga('send', 'event', categories.download, normalizedPlatform);
}
var GA = {};
GA.trackRegister = trackRegister;
GA.trackDownload = trackDownload;
context.JK.GA = GA;

View File

@ -30,13 +30,19 @@
// we flag it with this boolean
var matchesUserOS = currentOS != null && key.toLowerCase().indexOf(currentOS.toLowerCase()) > -1;
var platform = key.substring('JamClient/'.length);
var options = {
emphasis: matchesUserOS ? "currentOS" : "",
uri: item.uri,
platform: key.substring('JamClient/'.length)
platform: platform
}
var download = context._.template($('#client-download-link').html(), options, {variable: 'data'});
var download = $(context._.template($('#client-download-link').html(), options, { variable: 'data' }));
download.find('a').data('platform', platform).click(function() {
context.JK.GA.trackDownload($(this).data('platform'));
});
if(matchesUserOS) {
// make sure the current user OS is at the top

View File

@ -1,6 +1,7 @@
//= require jquery
//= require jquery.queryparams
//= require AAC_underscore
//= require globals
//= require jamkazam
//= require utils
//= require ga