1
0
mirror of https://github.com/bigchaindb/site.git synced 2025-02-14 21:10:28 +01:00

More Google Analytics custom events

- whitepaper download
- all form submissions (success & error)
This commit is contained in:
Matthias Kretschmann 2016-02-11 15:59:24 +01:00
parent 04ccb95c29
commit 7f8b9909f7
4 changed files with 42 additions and 1 deletions

View File

@ -24,6 +24,11 @@ var GoogleAnalytics = (function(w,d,$) {
$('.js-tracking-terminal').on('click', function() { $('.js-tracking-terminal').on('click', function() {
ga('send', 'event', 'terminal', 'terminal_click', 'selection', true); ga('send', 'event', 'terminal', 'terminal_click', 'selection', true);
}); });
// Whitepaper download
$('.js-tracking-whitepaper-download').on('click', function() {
ga('send', 'event', 'whitepaper', 'download', 'button', true);
});
}, },
@ -105,6 +110,22 @@ var GoogleAnalytics = (function(w,d,$) {
}, },
gaEventEarlyAccessError: function() { gaEventEarlyAccessError: function() {
ga('send', 'event', 'signup', 'early_access_form', 'error'); ga('send', 'event', 'signup', 'early_access_form', 'error');
},
// contact forms
gaEventContactSuccess: function() {
ga('send', 'event', 'contact', 'contact_form', 'success');
},
gaEventContactError: function() {
ga('send', 'event', 'contact', 'contact_form', 'error');
},
// CLA forms
gaEventClaSuccess: function() {
ga('send', 'event', 'cla', 'cla_form', 'success');
},
gaEventClaError: function() {
ga('send', 'event', 'cla', 'cla_form', 'error');
} }
}; };

View File

@ -51,12 +51,22 @@ var FormCla = (function(w, d, $) {
thisForm.find('.form-group').addClass('hide'); thisForm.find('.form-group').addClass('hide');
thisForm.find('.alert-success').removeClass('hide'); thisForm.find('.alert-success').removeClass('hide');
thisButton.removeClass('disabled'); thisButton.removeClass('disabled');
// send GA event
if (!_dntEnabled()) {
GoogleAnalytics.gaEventClaSuccess();
}
}, },
error: function(err) { error: function(err) {
thisForm.find('.alert-danger').removeClass('hide'); thisForm.find('.alert-danger').removeClass('hide');
thisButton thisButton
.removeClass('disabled') .removeClass('disabled')
.attr('value', 'Send'); .attr('value', 'Send');
// send GA event
if (!_dntEnabled()) {
GoogleAnalytics.gaEventClaError();
}
} }
}); });
} }

View File

@ -32,12 +32,22 @@ var FormContact = (function(w, d, $) {
_config.form.find('.form-group').addClass('hide'); _config.form.find('.form-group').addClass('hide');
_config.form.find('.alert-success').removeClass('hide'); _config.form.find('.alert-success').removeClass('hide');
_config.formBtn.removeClass('disabled'); _config.formBtn.removeClass('disabled');
// send GA event
if (!_dntEnabled()) {
GoogleAnalytics.gaEventContactSuccess();
}
}, },
error: function(err) { error: function(err) {
_config.form.find('.alert-danger').removeClass('hide'); _config.form.find('.alert-danger').removeClass('hide');
_config.formBtn _config.formBtn
.removeClass('disabled') .removeClass('disabled')
.attr('value', 'Send'); .attr('value', 'Send');
// send GA event
if (!_dntEnabled()) {
GoogleAnalytics.gaEventContactError();
}
} }
}); });
} }

View File

@ -35,7 +35,7 @@ layout: base
<p class="text-center"> <p class="text-center">
{% for whitepaper in page.whitepaper.files %} {% for whitepaper in page.whitepaper.files %}
<a href="{{ whitepaper.file }}" class="btn btn-primary btn-sm"><svg class="icon"><use xlink:href="/assets/img/sprite.svg#icon-documents"></use></svg> {{ whitepaper.button }}</a> <a href="{{ whitepaper.file }}" class="btn btn-primary btn-sm js-tracking-whitepaper-download"><svg class="icon"><use xlink:href="/assets/img/sprite.svg#icon-documents"></use></svg> {{ whitepaper.button }}</a>
{% endfor %} {% endfor %}
</p> </p>
</div> </div>