* VRFS-709 - track client downloads
This commit is contained in:
parent
3c69988d1d
commit
9c426fc5a7
|
|
@ -1,6 +1,7 @@
|
|||
//= require jquery
|
||||
//= require jquery.queryparams
|
||||
//= require AAC_underscore
|
||||
//= require globals
|
||||
//= require jamkazam
|
||||
//= require utils
|
||||
//= require ga
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
//= require jquery
|
||||
//= require jquery.queryparams
|
||||
//= require AAC_underscore
|
||||
//= require globals
|
||||
//= require jamkazam
|
||||
//= require utils
|
||||
//= require ga
|
||||
|
|
|
|||
Loading…
Reference in New Issue