From f2d5c0756a6cbf279d570be0641f59a1a95ad3e5 Mon Sep 17 00:00:00 2001 From: runnabro Date: Wed, 21 Sep 2016 11:56:31 -0700 Subject: [PATCH 1/6] add mix panel event on org select --- client/services/serviceEventTracking.js | 1 + layout.jade | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/services/serviceEventTracking.js b/client/services/serviceEventTracking.js index 76158191e..a3b1c43ea 100644 --- a/client/services/serviceEventTracking.js +++ b/client/services/serviceEventTracking.js @@ -372,6 +372,7 @@ EventTracking.prototype.visitedOrgSelectPage = function () { var self = this; var eventName = 'Visited org-select page'; + self._mixpanel('track', eventName); self.analytics.ready(function () { self.analytics.track(eventName); }); diff --git a/layout.jade b/layout.jade index 1f2351e5e..ad52d6422 100644 --- a/layout.jade +++ b/layout.jade @@ -123,9 +123,10 @@ html( if (env === 'staging') script. - (function(f,b){if(!b.__SV){var a,e,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" "); - for(g=0;g Date: Wed, 21 Sep 2016 12:10:10 -0700 Subject: [PATCH 2/6] fix mix panel script --- layout.jade | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/layout.jade b/layout.jade index ad52d6422..15d9e12c3 100644 --- a/layout.jade +++ b/layout.jade @@ -120,8 +120,7 @@ html( (function(f,b){if(!b.__SV){var a,e,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" "); for(g=0;g Date: Wed, 21 Sep 2016 15:15:19 -0700 Subject: [PATCH 3/6] track org select --- .../chooseOrganizationModalController.js | 4 ++++ .../chooseOrganizationModalView.jade | 1 + client/services/serviceEventTracking.js | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalController.js b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalController.js index 51aaceecf..663e33908 100644 --- a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalController.js +++ b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalController.js @@ -10,6 +10,7 @@ function ChooseOrganizationModalController( ahaGuide, createNewSandboxForUserService, errs, + eventTracking, featureFlags, fetchWhitelistForDockCreated, keypather, @@ -38,6 +39,9 @@ function ChooseOrganizationModalController( }; $scope.actions = { + selectedOrg: function(selectedOrgName) { + eventTracking.selectedOrg(selectedOrgName); + }, selectAccount: function (selectedOrgName) { $state.go('base.instances', { userName: selectedOrgName diff --git a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade index c0948e443..58f1ad83d 100644 --- a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade +++ b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade @@ -79,6 +79,7 @@ ) span.grid-block.text-left.text-overflow {{org.oauthName()}} input.checkbox.hidden( + ng-change = "actions.selectedOrg(org.oauthName())" ng-model = "COS.selectedOrgName" value = "{{org.oauthName()}}" type = "radio" diff --git a/client/services/serviceEventTracking.js b/client/services/serviceEventTracking.js index a3b1c43ea..654ec35c5 100644 --- a/client/services/serviceEventTracking.js +++ b/client/services/serviceEventTracking.js @@ -365,6 +365,7 @@ EventTracking.prototype.createdNonRepoContainer = function (containerName) { /** * Track user visit to /orgSelect page * Reports to: + * - mixpanel * - segment * @return this */ @@ -379,6 +380,23 @@ EventTracking.prototype.visitedOrgSelectPage = function () { return self; }; +/** + * Track user clicks on an org on the orgSelect page + * Reports to: + * - mixpanel + * @return this + */ +EventTracking.prototype.selectedOrg = function (org) { + var self = this; + var eventName = 'Selected an org'; + + self._mixpanel('track', eventName, { + org: org + }); + return self; +}; + + /** * Track org click on /orgSelect page * Reports to: From e6ef2b0efb7ab46f9066421ae083094c4647fb3e Mon Sep 17 00:00:00 2001 From: runnabro Date: Wed, 21 Sep 2016 16:34:17 -0700 Subject: [PATCH 4/6] send event names to mix panel --- .../chooseOrganizationModalView.jade | 6 +++--- client/directives/ngclick.js | 1 + client/services/serviceEventTracking.js | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade index 58f1ad83d..f6c1a04e6 100644 --- a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade +++ b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade @@ -97,9 +97,8 @@ ) //- disabled until an org is selected button.btn.btn-md.green( - ng-click = "\ - actions.createOrCheckDock(COS.selectedOrgName, goToPanel);\ - " + event-name = "Org Confirmed" + ng-click = "actions.createOrCheckDock(COS.selectedOrgName, goToPanel)" ng-disabled = "!COS.selectedOrgName" ) Confirm Organization @@ -145,6 +144,7 @@ ng-class = "{'in': isActivePanel()}" ) button.btn.btn-md.green( + event-name = "Nav to Runnable (after infrastructure wait)" ng-click = "actions.selectAccount(COS.selectedOrgName)" ) Go to Runnable .grid-block.justify-center.modal-outer-footer( diff --git a/client/directives/ngclick.js b/client/directives/ngclick.js index 3a1415d24..67582e8f6 100644 --- a/client/directives/ngclick.js +++ b/client/directives/ngclick.js @@ -22,6 +22,7 @@ function ngClick( }); eventTracking.trackClicked({ attrs: cleanedAttrs, + eventName: attrs.eventName, text: text }); } diff --git a/client/services/serviceEventTracking.js b/client/services/serviceEventTracking.js index 654ec35c5..238b08ea9 100644 --- a/client/services/serviceEventTracking.js +++ b/client/services/serviceEventTracking.js @@ -309,7 +309,8 @@ EventTracking.prototype.update = function () { */ EventTracking.prototype.trackClicked = function (data) { var self = this; - self._mixpanel('track', 'clicked - ' + _keypather.get(data, 'text'), data); + + self._mixpanel('track', 'Click', data); self.analytics.ready(function () { self.analytics.track('Click', data); }); @@ -388,7 +389,7 @@ EventTracking.prototype.visitedOrgSelectPage = function () { */ EventTracking.prototype.selectedOrg = function (org) { var self = this; - var eventName = 'Selected an org'; + var eventName = 'Org Selected'; self._mixpanel('track', eventName, { org: org From 3ff66351f806fead135a03172ea9bd382683257a Mon Sep 17 00:00:00 2001 From: runnabro Date: Wed, 21 Sep 2016 16:40:58 -0700 Subject: [PATCH 5/6] fix function --- .../chooseOrganizationModalController.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalController.js b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalController.js index 663e33908..fabc0b918 100644 --- a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalController.js +++ b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalController.js @@ -39,9 +39,7 @@ function ChooseOrganizationModalController( }; $scope.actions = { - selectedOrg: function(selectedOrgName) { - eventTracking.selectedOrg(selectedOrgName); - }, + selectedOrg: eventTracking.selectedOrg.bind(eventTracking), selectAccount: function (selectedOrgName) { $state.go('base.instances', { userName: selectedOrgName From 0faba4a950c10d9157fc0f8e3e861c64e430e051 Mon Sep 17 00:00:00 2001 From: runnabro Date: Wed, 21 Sep 2016 16:57:40 -0700 Subject: [PATCH 6/6] prepend event-names with data- --- .../modalChooseOrganization/chooseOrganizationModalView.jade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade index f6c1a04e6..668cb157d 100644 --- a/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade +++ b/client/directives/modals/modalChooseOrganization/chooseOrganizationModalView.jade @@ -97,7 +97,7 @@ ) //- disabled until an org is selected button.btn.btn-md.green( - event-name = "Org Confirmed" + data-event-name = "Org Confirmed" ng-click = "actions.createOrCheckDock(COS.selectedOrgName, goToPanel)" ng-disabled = "!COS.selectedOrgName" ) Confirm Organization @@ -144,7 +144,7 @@ ng-class = "{'in': isActivePanel()}" ) button.btn.btn-md.green( - event-name = "Nav to Runnable (after infrastructure wait)" + data-event-name = "Nav to Runnable (after infrastructure wait)" ng-click = "actions.selectAccount(COS.selectedOrgName)" ) Go to Runnable .grid-block.justify-center.modal-outer-footer(