From 2fad4ade6bdf54c8c3c9006d0d97a533a3e064c5 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 21 Dec 2015 14:08:20 +0100 Subject: [PATCH] track form success/fail submissions in Google Analytics, ref #2 --- _src/_assets/javascripts/bigchain/analytics.js | 6 ++++++ _src/_assets/javascripts/bigchain/form-earlyaccess.js | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/_src/_assets/javascripts/bigchain/analytics.js b/_src/_assets/javascripts/bigchain/analytics.js index 270427d..b82ea0b 100644 --- a/_src/_assets/javascripts/bigchain/analytics.js +++ b/_src/_assets/javascripts/bigchain/analytics.js @@ -89,6 +89,12 @@ var GoogleAnalytics = (function(w,d) { _private.gaBreakpoints(); _private.gaViewport(); _private.gaPixelDensity(); + }, + gaEventEarlyAccessSuccess: function() { + ga('send', 'event', 'signup', 'early_access_form', 'success', true); + }, + gaEventEarlyAccessError: function() { + ga('send', 'event', 'signup', 'early_access_form', 'error', true); } }; diff --git a/_src/_assets/javascripts/bigchain/form-earlyaccess.js b/_src/_assets/javascripts/bigchain/form-earlyaccess.js index f24de55..6bc9b48 100644 --- a/_src/_assets/javascripts/bigchain/form-earlyaccess.js +++ b/_src/_assets/javascripts/bigchain/form-earlyaccess.js @@ -9,7 +9,7 @@ var FormEarlyAccess = (function(w, d, $) { form: $('#form-earlyaccess'), formBtn: $('#form-earlyaccess').find('.btn'), formURL: $('#form-earlyaccess').attr('action'), - formMethod: $('#form-earlyaccess').attr('metthod') + formMethod: $('#form-earlyaccess').attr('method') }; _private = { @@ -35,11 +35,15 @@ var FormEarlyAccess = (function(w, d, $) { _config.form.find('.alert-success').removeClass('hide'); _config.formBtn.removeClass('disabled'); - //GoogleAnalytics.gaEventEarlyAccess(); + // send GA event + GoogleAnalytics.gaEventEarlyAccessSuccess(); }, error: function(err) { _config.form.find('.alert-danger').removeClass('hide'); _config.formBtn.removeClass('disabled'); + + // send GA event + GoogleAnalytics.gaEventEarlyAccessError(); } }); }