diff --git a/src/js/controllers/addressbookAdd.js b/src/js/controllers/addressbookAdd.js index ff284b234..cf2080b1c 100644 --- a/src/js/controllers/addressbookAdd.js +++ b/src/js/controllers/addressbookAdd.js @@ -45,7 +45,7 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu } var log = new window.BitAnalytics.LogEvent("contact_created", [{ "coin": $scope.addressbookEntry.coin - }], [channel]); + }], [channel, 'leanplum']); window.BitAnalytics.LogEventHandlers.postEvent(log); $timeout(function() { diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 76950df73..00c26e029 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -705,7 +705,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( "type": "outgoing", "amount": $scope.amount, "fees": $scope.fee - }], [channel, "adjust"]); + }], [channel, 'adjust', 'leanplum']); window.BitAnalytics.LogEventHandlers.postEvent(log); $timeout(function() { diff --git a/src/js/controllers/preferencesNotifications.js b/src/js/controllers/preferencesNotifications.js index a9a833ff7..e34b1b920 100644 --- a/src/js/controllers/preferencesNotifications.js +++ b/src/js/controllers/preferencesNotifications.js @@ -82,7 +82,7 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr } var log = new window.BitAnalytics.LogEvent("settings_email_notification_toggle", [{ "toggle": $scope.emailNotifications.value - }], [channel]); + }], [channel, 'leanplum']); window.BitAnalytics.LogEventHandlers.postEvent(log); }; diff --git a/src/js/controllers/review.controller.js b/src/js/controllers/review.controller.js index 15f982f2f..952b1a3d3 100644 --- a/src/js/controllers/review.controller.js +++ b/src/js/controllers/review.controller.js @@ -4,7 +4,7 @@ angular .module('copayApp.controllers') .controller('reviewController', reviewController); -function reviewController(addressbookService, bitcoinCashJsService, bitcore, bitcoreCash, bwcError, clipboardService, configService, feeService, gettextCatalog, $interval, $ionicHistory, $ionicModal, ionicToast, lodash, $log, ongoingProcess, platformInfo, popupService, profileService, $scope, sendFlowService, shapeshiftService, soundService, $state, $timeout, txConfirmNotification, txFormatService, walletService) { +function reviewController(addressbookService, bitAnalyticsService, bitcoinCashJsService, bitcore, bitcoreCash, bwcError, clipboardService, configService, feeService, gettextCatalog, $interval, $ionicHistory, $ionicModal, ionicToast, lodash, $log, ongoingProcess, platformInfo, popupService, profileService, $scope, sendFlowService, shapeshiftService, soundService, $state, $timeout, txConfirmNotification, txFormatService, walletService) { var vm = this; vm.buttonText = ''; @@ -65,6 +65,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit var destinationWalletId = ''; var lastTxId = ''; var originWalletId = ''; + var personalNoteWasBlank = true; var priceDisplayIsFiat = true; var satoshis = null; var toAddress = ''; @@ -156,6 +157,10 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit return; } + if (personalNoteWasBlank && vm.memo && vm.memo.length > 0) { + bitAnalyticsService.postEvent('transfer_adds_memo', [], ['leanplum']); + } + ongoingProcess.set('creatingTx', true, statusChangeHandler); getTxp(lodash.clone(tx), vm.originWallet, false, function(err, txp) { ongoingProcess.set('creatingTx', false, statusChangeHandler); @@ -534,6 +539,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit tx.toAddress = shapeshiftData.toAddress; vm.memo = 'ShapeShift Order:\nhttps://www.shapeshift.io/#/status/' + shapeshiftData.orderId; vm.memoExpanded = !!vm.memo; + personalNoteWasBlank = !vm.memo; ongoingProcess.set('connectingShapeshift', false); cb(); } @@ -803,7 +809,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit "type": "outgoing", "amount": amount, "fees": vm.feeCrypto - }], [channel, "adjust"]); + }], [channel, "adjust", 'leanplum']); window.BitAnalytics.LogEventHandlers.postEvent(log); $timeout(function() { diff --git a/src/js/controllers/shapeshift.js b/src/js/controllers/shapeshift.js index 0dac21a11..69152bf75 100644 --- a/src/js/controllers/shapeshift.js +++ b/src/js/controllers/shapeshift.js @@ -40,7 +40,7 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi }); }; - $scope.shapeshift = function() { + $scope.shapeshift = function() { var stateParams = { thirdParty: { id: 'shapeshift' diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index 320afe320..574ebf7b2 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -154,7 +154,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi var log = new window.BitAnalytics.LogEvent("transfer_success", [{ "coin": $scope.wallet.coin, "type": "incoming" - }], [channel, "adjust"]); + }], [channel, "adjust", 'leanplum']); window.BitAnalytics.LogEventHandlers.postEvent(log); if ($state.current.name === "tabs.receive") { diff --git a/src/js/controllers/wallet-details.controller.js b/src/js/controllers/wallet-details.controller.js index f3109db8b..062296907 100644 --- a/src/js/controllers/wallet-details.controller.js +++ b/src/js/controllers/wallet-details.controller.js @@ -52,7 +52,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun if (platformInfo.isCordova) { channel = "firebase"; } - var log = new window.BitAnalytics.LogEvent("wallet_details_open", [], [channel]); + var log = new window.BitAnalytics.LogEvent("wallet_details_open", [], [channel, 'leanplum']); window.BitAnalytics.LogEventHandlers.postEvent(log); $scope.openExternalLink = function(url, target) { diff --git a/src/js/services/bit-analytics.service.js b/src/js/services/bit-analytics.service.js new file mode 100644 index 000000000..cb29fb5f0 --- /dev/null +++ b/src/js/services/bit-analytics.service.js @@ -0,0 +1,39 @@ +'use strict'; + +(function(){ + + angular + .module('bitcoincom.services') + .factory('bitAnalyticsService', bitAnalyticsService); + + function bitAnalyticsService(platformInfo) { + var service = { + postEvent: postEvent + }; + + var defaultChannels = ['ga']; + if (platformInfo.isCordova) { + defaultChannels = 'firebase'; + } + + return service; + + /** + * Sends an event to analytics channels. + * @param {string} name - The name of the event. + * @param {Object[]} params - Parameters to send with the event. + * [0] - shared parameters for all channels. + * [1] - parameters for the default channel. + * Subsequent objects are sent with the other channels, in the corresponding order. + * @param {string[]} additionalChannels - Names of more channels to send the event to. + */ + function postEvent(name, params, additionalChannels) { + var allChannels = defaultChannels.concat(additionalChannels); + + var log = new window.BitAnalytics.LogEvent(name, params, allChannels); + window.BitAnalytics.LogEventHandlers.postEvent(log); + } + + } + +})(); \ No newline at end of file diff --git a/src/js/services/buyAndSellService.js b/src/js/services/buyAndSellService.js index d5f52b08e..4ec190368 100644 --- a/src/js/services/buyAndSellService.js +++ b/src/js/services/buyAndSellService.js @@ -26,8 +26,7 @@ angular.module('copayApp.services').factory('buyAndSellService', function(gettex title: gettextCatalog.getString('Buy Bitcoin'), name: 'buyandsell', icon: 'icon-buy-bitcoin2', - sref: 'tabs.buyandsell', - trackingClass: 'track_buy_bitcoin_click' + sref: 'tabs.buyandsell' }); } else { servicesService.unregister({ diff --git a/src/js/services/servicesService.js b/src/js/services/servicesService.js index 06220b669..56d699e59 100644 --- a/src/js/services/servicesService.js +++ b/src/js/services/servicesService.js @@ -5,8 +5,7 @@ angular.module('copayApp.services').factory('servicesService', function(configSe name: 'shapeshift', title: 'Shapeshift', icon: 'icon-shapeshift', - sref: 'tabs.shapeshift', - trackingClass: 'track_link_click_out' + sref: 'tabs.shapeshift' }]; root.register = function(serviceInfo) { diff --git a/www/views/includes/services.html b/www/views/includes/services.html index c2f3132ac..f57cd1004 100644 --- a/www/views/includes/services.html +++ b/www/views/includes/services.html @@ -6,7 +6,7 @@