Wiring up analytics for courseware, unifying analytics between coursewares and bonfires, general housekeeping tasks for live push

This commit is contained in:
Michael Q Larson
2015-02-07 21:11:26 -08:00
parent 07c5757538
commit 180699adb2
8 changed files with 19 additions and 12 deletions

View File

@@ -114,7 +114,7 @@ $('#submitButton').on('click', function () {
function bonfireExecute() {
attempts++;
ga('send', 'event', 'Bonfire', 'ran-code', bonfireName);
ga('send', 'event', 'Bonfire', 'ran-code', challengeName);
userTests= null;
$('#codeOutput').empty();
var userJavaScript = myCodeMirror.getValue();
@@ -239,8 +239,7 @@ var runTests = function(err, data) {
function showCompletion() {
var time = Math.floor(Date.now() / 1000) - started;
console.log(time);
ga('send', 'event', 'Bonfire', 'solved', bonfireName + ', Time: ' + time +', Attempts: ' + attempts);
ga('send', 'event', 'Challenge', 'solved', challengeName + ', Time: ' + time +', Attempts: ' + attempts);
$('#complete-bonfire-dialog').modal('show');
$('#complete-bonfire-dialog').keydown(function(e) {
if (e.ctrlKey && e.keyCode == 13) {

View File

@@ -43,6 +43,12 @@ var libraryIncludes = "<script src='//ajax.googleapis.com/ajax/libs/jquery/2.1.3
"<link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css'/>" +
"<style>body { padding: 0px 3px 0px 3px; }</style>";
var allTests = '';
(function() {
tests.forEach(function(elem) {
allTests += elem + ' ';
});
})();
var otherTestsForNow = "<script src='/js/lib/coursewares/iFrameScripts.js'></script>";
@@ -112,10 +118,12 @@ function doLinting () {
function showCompletion() {
var time = Math.floor(Date.now() / 1000) - started;
ga('send', 'event', 'Challenge', 'solved', challengeName + ', Time: ' + time);
$('#complete-courseware-dialog').modal('show');
$('#complete-courseware-dialog').keydown(function(e) {
if (e.ctrlKey && e.keyCode == 13) {
$('.next-courseware-button').click();
}
});
}
}

View File

@@ -5,7 +5,6 @@
try {
eval(parent.allTests);
} catch (err) {
console.log(err);
allTestsGood = false;
} finally {
if (allTestsGood) {

View File

@@ -1,6 +1,7 @@
$(document).ready(function() {
if (bonfireName) {
ga('send', 'event', 'Bonfire', 'load', bonfireName + ':' + Math.floor(Date.now() / 1000));
challengeName = challengeName || 'Untitled';
if (challengeName) {
ga('send', 'event', 'Challenge', 'load', challengeName);
}
var CSRF_HEADER = 'X-CSRF-Token';
@@ -107,7 +108,7 @@ $(document).ready(function() {
// Bonfire instructions functions
$('#more-info').on('click', function() {
ga('send', 'event', 'Bonfire', 'more-info', bonfireName);
ga('send', 'event', 'Challenge', 'more-info', challengeName);
$('#brief-instructions').hide();
$('#long-instructions').show().removeClass('hide');