Skip to content

Commit

Permalink
Send analytics event through the GOV.UK Analytics API.
Browse files Browse the repository at this point in the history
https://www.pivotaltracker.com/n/projects/1261204/stories/88175032

This change wraps the GA event in the [newly introduced](alphagov/static#549)
analytics API. This will aid in the migration from GA Classic to Universal Analytics, while
remaining functionally equivalent during the migration.

This commit also removes a commented out line.
  • Loading branch information
benilovj committed Mar 2, 2015
1 parent 3fec17b commit 417d336
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/assets/javascripts/smart-answers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ function browserSupportsHtml5HistoryApi() {
}

$(document).ready(function() {
//_gaq.push(['_trackEvent', 'Citizen-Format-Smartanswer', 'Load']);
if(browserSupportsHtml5HistoryApi()) {
var formSelector = ".current form";

Expand All @@ -27,15 +26,15 @@ $(document).ready(function() {

// Track when a user clicks on 'Start again' link
$('.start-right').live('click', function() {
window._gaq && window._gaq.push(['_trackEvent', 'MS_smart_answer', getCurrentPosition(), 'Start again']);
GOVUK && GOVUK.analytics && GOVUK.analytics.trackEvent && GOVUK.analytics.trackEvent('MS_smart_answer', getCurrentPosition(), {label: 'Start again'});
reloadQuestions($(this).attr('href'));
return false;
});

// Track when a user clicks on a 'Change Answer' link
$('.link-right a').live('click', function() {
var href = $(this).attr('href');
window._gaq && window._gaq.push(['_trackEvent', 'MS_smart_answer', href, 'Change Answer']);
GOVUK && GOVUK.analytics && GOVUK.analytics.trackEvent && GOVUK.analytics.trackEvent('MS_smart_answer', href, {label: 'Change Answer'});
reloadQuestions(href);
return false;
});
Expand Down

0 comments on commit 417d336

Please sign in to comment.