Adding analytics to bonfire
This commit is contained in:
@ -22,6 +22,11 @@ var editor = myCodeMirror;
|
||||
editor.setSize("100%", "auto");
|
||||
|
||||
|
||||
var attempts = 0;
|
||||
if (attempts) {
|
||||
attempts = 0;
|
||||
}
|
||||
|
||||
// Default value for editor if one isn't provided in (i.e. a challenge)
|
||||
var nonChallengeValue = '/*Welcome to Bonfire, Free Code Camp\'s future CoderByte replacement.\n' +
|
||||
'Please feel free to use Bonfire as an in-browser playground and linting tool.\n' +
|
||||
@ -100,15 +105,18 @@ $('#submitButton').on('click', function () {
|
||||
});
|
||||
|
||||
function bonfireExecute() {
|
||||
attempts++;
|
||||
ga('send', 'event', 'Bonfire', 'ran-code', bonfireName);
|
||||
userTests= null;
|
||||
$('#codeOutput').empty();
|
||||
var userJavaScript = myCodeMirror.getValue();
|
||||
userJavaScript = removeComments(userJavaScript);
|
||||
userJavaScript = scrapeTests(userJavaScript);
|
||||
// simple fix in case the user forgets to invoke their function
|
||||
if (challengeEntryPoint) {
|
||||
if (challengeEntryPoint && challengeSeed) {
|
||||
userJavaScript = challengeEntryPoint + ' ' + userJavaScript;
|
||||
}
|
||||
console.log(userJavaScript);
|
||||
submit(userJavaScript, function(cls, message) {
|
||||
if (cls) {
|
||||
codeOutput.setValue(message.error);
|
||||
@ -224,5 +232,7 @@ var runTests = function(err, data) {
|
||||
};
|
||||
|
||||
function showCompletion() {
|
||||
|
||||
ga('send', 'event', 'Bonfire', 'solved', bonfireName + ', Time: ' + (Math.floor(Date.now() / 1000) - started) +', Attempts: ' + attempts);
|
||||
$('#complete-bonfire-dialog').modal('show');
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
$(document).ready(function() {
|
||||
if (bonfireName !== undefined) {
|
||||
ga('send', 'event', 'Bonfire', 'load', bonfireName + ':' + Math.floor(Date.now() / 1000));
|
||||
}
|
||||
|
||||
var CSRF_HEADER = 'X-CSRF-Token';
|
||||
|
||||
@ -61,7 +64,6 @@ $(document).ready(function() {
|
||||
var bonfireSolution = myCodeMirror.getValue();
|
||||
var thisBonfireHash = passedBonfireHash || null;
|
||||
var didCompleteWith = $('#completed-with').val() || null;
|
||||
|
||||
completedBonfire(didCompleteWith, bonfireSolution, thisBonfireHash);
|
||||
|
||||
});
|
||||
@ -83,6 +85,7 @@ $(document).ready(function() {
|
||||
|
||||
// Bonfire instructions functions
|
||||
$('#more-info').on('click', function() {
|
||||
ga('send', 'event', 'Bonfire', 'more-info', bonfireName);
|
||||
$('#brief-instructions').hide();
|
||||
$('#long-instructions').show().removeClass('hide');
|
||||
|
||||
@ -91,6 +94,12 @@ $(document).ready(function() {
|
||||
$('#brief-instructions').show();
|
||||
$('#long-instructions').hide();
|
||||
});
|
||||
|
||||
// Bonfire analytics
|
||||
$('#submitButton').on('click', function() {
|
||||
attempts++;
|
||||
ga('send', 'event', 'Bonfire', 'ran-code', bonfireName);
|
||||
})
|
||||
});
|
||||
|
||||
var profileValidation = angular.module('profileValidation',['ui.bootstrap']);
|
||||
|
@ -90,6 +90,8 @@ block content
|
||||
var challengeSeed = !{JSON.stringify(challengeSeed)};
|
||||
var challengeEntryPoint = !{JSON.stringify(challengeEntryPoint)};
|
||||
var passedBonfireHash = !{JSON.stringify(bonfireHash)};
|
||||
var bonfireName = !{JSON.stringify(name)};
|
||||
var started = Math.floor(Date.now() / 1000);
|
||||
.col-xs-12.col-sm-12.col-md-8
|
||||
#mainEditorPanel
|
||||
form.code
|
||||
|
Reference in New Issue
Block a user