Sending more events to Leanplum.

This commit is contained in:
Brendon Duncan 2018-09-13 11:56:18 +12:00
commit 28ce4d302d
11 changed files with 56 additions and 13 deletions

View file

@ -45,7 +45,7 @@ angular.module('copayApp.controllers').controller('addressbookAddController', fu
} }
var log = new window.BitAnalytics.LogEvent("contact_created", [{ var log = new window.BitAnalytics.LogEvent("contact_created", [{
"coin": $scope.addressbookEntry.coin "coin": $scope.addressbookEntry.coin
}], [channel]); }], [channel, 'leanplum']);
window.BitAnalytics.LogEventHandlers.postEvent(log); window.BitAnalytics.LogEventHandlers.postEvent(log);
$timeout(function() { $timeout(function() {

View file

@ -705,7 +705,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
"type": "outgoing", "type": "outgoing",
"amount": $scope.amount, "amount": $scope.amount,
"fees": $scope.fee "fees": $scope.fee
}], [channel, "adjust"]); }], [channel, 'adjust', 'leanplum']);
window.BitAnalytics.LogEventHandlers.postEvent(log); window.BitAnalytics.LogEventHandlers.postEvent(log);
$timeout(function() { $timeout(function() {

View file

@ -82,7 +82,7 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr
} }
var log = new window.BitAnalytics.LogEvent("settings_email_notification_toggle", [{ var log = new window.BitAnalytics.LogEvent("settings_email_notification_toggle", [{
"toggle": $scope.emailNotifications.value "toggle": $scope.emailNotifications.value
}], [channel]); }], [channel, 'leanplum']);
window.BitAnalytics.LogEventHandlers.postEvent(log); window.BitAnalytics.LogEventHandlers.postEvent(log);
}; };

View file

@ -4,7 +4,7 @@ angular
.module('copayApp.controllers') .module('copayApp.controllers')
.controller('reviewController', reviewController); .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; var vm = this;
vm.buttonText = ''; vm.buttonText = '';
@ -65,6 +65,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
var destinationWalletId = ''; var destinationWalletId = '';
var lastTxId = ''; var lastTxId = '';
var originWalletId = ''; var originWalletId = '';
var personalNoteWasBlank = true;
var priceDisplayIsFiat = true; var priceDisplayIsFiat = true;
var satoshis = null; var satoshis = null;
var toAddress = ''; var toAddress = '';
@ -156,6 +157,10 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
return; return;
} }
if (personalNoteWasBlank && vm.memo && vm.memo.length > 0) {
bitAnalyticsService.postEvent('transfer_adds_memo', [], ['leanplum']);
}
ongoingProcess.set('creatingTx', true, statusChangeHandler); ongoingProcess.set('creatingTx', true, statusChangeHandler);
getTxp(lodash.clone(tx), vm.originWallet, false, function(err, txp) { getTxp(lodash.clone(tx), vm.originWallet, false, function(err, txp) {
ongoingProcess.set('creatingTx', false, statusChangeHandler); ongoingProcess.set('creatingTx', false, statusChangeHandler);
@ -534,6 +539,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
tx.toAddress = shapeshiftData.toAddress; tx.toAddress = shapeshiftData.toAddress;
vm.memo = 'ShapeShift Order:\nhttps://www.shapeshift.io/#/status/' + shapeshiftData.orderId; vm.memo = 'ShapeShift Order:\nhttps://www.shapeshift.io/#/status/' + shapeshiftData.orderId;
vm.memoExpanded = !!vm.memo; vm.memoExpanded = !!vm.memo;
personalNoteWasBlank = !vm.memo;
ongoingProcess.set('connectingShapeshift', false); ongoingProcess.set('connectingShapeshift', false);
cb(); cb();
} }
@ -803,7 +809,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
"type": "outgoing", "type": "outgoing",
"amount": amount, "amount": amount,
"fees": vm.feeCrypto "fees": vm.feeCrypto
}], [channel, "adjust"]); }], [channel, "adjust", 'leanplum']);
window.BitAnalytics.LogEventHandlers.postEvent(log); window.BitAnalytics.LogEventHandlers.postEvent(log);
$timeout(function() { $timeout(function() {

View file

@ -154,7 +154,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
var log = new window.BitAnalytics.LogEvent("transfer_success", [{ var log = new window.BitAnalytics.LogEvent("transfer_success", [{
"coin": $scope.wallet.coin, "coin": $scope.wallet.coin,
"type": "incoming" "type": "incoming"
}], [channel, "adjust"]); }], [channel, "adjust", 'leanplum']);
window.BitAnalytics.LogEventHandlers.postEvent(log); window.BitAnalytics.LogEventHandlers.postEvent(log);
if ($state.current.name === "tabs.receive") { if ($state.current.name === "tabs.receive") {

View file

@ -52,7 +52,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
if (platformInfo.isCordova) { if (platformInfo.isCordova) {
channel = "firebase"; 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); window.BitAnalytics.LogEventHandlers.postEvent(log);
$scope.openExternalLink = function(url, target) { $scope.openExternalLink = function(url, target) {

View file

@ -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);
}
}
})();

View file

@ -26,8 +26,7 @@ angular.module('copayApp.services').factory('buyAndSellService', function(gettex
title: gettextCatalog.getString('Buy Bitcoin'), title: gettextCatalog.getString('Buy Bitcoin'),
name: 'buyandsell', name: 'buyandsell',
icon: 'icon-buy-bitcoin2', icon: 'icon-buy-bitcoin2',
sref: 'tabs.buyandsell', sref: 'tabs.buyandsell'
trackingClass: 'track_buy_bitcoin_click'
}); });
} else { } else {
servicesService.unregister({ servicesService.unregister({

View file

@ -5,8 +5,7 @@ angular.module('copayApp.services').factory('servicesService', function(configSe
name: 'shapeshift', name: 'shapeshift',
title: 'Shapeshift', title: 'Shapeshift',
icon: 'icon-shapeshift', icon: 'icon-shapeshift',
sref: 'tabs.shapeshift', sref: 'tabs.shapeshift'
trackingClass: 'track_link_click_out'
}]; }];
root.register = function(serviceInfo) { root.register = function(serviceInfo) {

View file

@ -6,7 +6,7 @@
</div> </div>
<div ng-show="!hide"> <div ng-show="!hide">
<div ng-repeat="service in services track by $index"> <div ng-repeat="service in services track by $index">
<a ui-sref="{{service.sref}}" id="home_{{service.name}}" title="{{service.title || service.name}}" class="{{service.trackingClass}} item item-sub item-icon-left item-big-icon-left item-icon-right next-step"> <a ui-sref="{{service.sref}}" id="home_{{service.name}}" title="{{service.title || service.name}}" class="track_link_click_out item item-sub item-icon-left item-big-icon-left item-icon-right next-step">
<i class="icon big-icon-svg theme-circle theme-circle-services"> <i class="icon big-icon-svg theme-circle theme-circle-services">
<div class="bg {{service.icon}}"></div> <div class="bg {{service.icon}}"></div>
</i> </i>