From 12a99fa4b51c2860a6835bdaa0042ef421f6ed0f Mon Sep 17 00:00:00 2001 From: cTn Date: Thu, 20 Nov 2014 19:29:43 +0100 Subject: [PATCH] track settings changes via events --- main.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index d3a05c20..225cab8d 100644 --- a/main.js +++ b/main.js @@ -148,13 +148,14 @@ $(document).ready(function () { // if notifications are enabled, or wasn't set, check the notifications checkbox chrome.storage.local.get('update_notify', function (result) { - if (result.update_notify === 'undefined' || result.update_notify) { + if (typeof result.update_notify === 'undefined' || result.update_notify) { $('div.notifications input').prop('checked', true); } }); $('div.notifications input').change(function () { var check = $(this).is(':checked'); + googleAnalytics.sendEvent('Settings', 'Notifications', check); chrome.storage.local.set({'update_notify': check}); }); @@ -165,8 +166,9 @@ $(document).ready(function () { } $('div.statistics input').change(function () { - var result = $(this).is(':checked'); - googleAnalyticsConfig.setTrackingPermitted(result); + var check = $(this).is(':checked'); + googleAnalytics.sendEvent('Settings', 'GoogleAnalytics', check); + googleAnalyticsConfig.setTrackingPermitted(check); }); function close_and_cleanup(e) {