Skip to content

Commit

Permalink
Merge pull request #1782 from CodeNow/add-mixpanel-events
Browse files Browse the repository at this point in the history
add mix panel event on org select
  • Loading branch information
runnabro authored Sep 22, 2016
2 parents d764d16 + 0faba4a commit fffa377
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function ChooseOrganizationModalController(
ahaGuide,
createNewSandboxForUserService,
errs,
eventTracking,
featureFlags,
fetchWhitelistForDockCreated,
keypather,
Expand Down Expand Up @@ -38,6 +39,7 @@ function ChooseOrganizationModalController(
};

$scope.actions = {
selectedOrg: eventTracking.selectedOrg.bind(eventTracking),
selectAccount: function (selectedOrgName) {
$state.go('base.instances', {
userName: selectedOrgName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -96,9 +97,8 @@
)
//- disabled until an org is selected
button.btn.btn-md.green(
ng-click = "\
actions.createOrCheckDock(COS.selectedOrgName, goToPanel);\
"
data-event-name = "Org Confirmed"
ng-click = "actions.createOrCheckDock(COS.selectedOrgName, goToPanel)"
ng-disabled = "!COS.selectedOrgName"
) Confirm Organization

Expand Down Expand Up @@ -144,6 +144,7 @@
ng-class = "{'in': isActivePanel()}"
)
button.btn.btn-md.green(
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(
Expand Down
1 change: 1 addition & 0 deletions client/directives/ngclick.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function ngClick(
});
eventTracking.trackClicked({
attrs: cleanedAttrs,
eventName: attrs.eventName,
text: text
});
}
Expand Down
22 changes: 21 additions & 1 deletion client/services/serviceEventTracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down Expand Up @@ -365,19 +366,38 @@ EventTracking.prototype.createdNonRepoContainer = function (containerName) {
/**
* Track user visit to /orgSelect page
* Reports to:
* - mixpanel
* - segment
* @return this
*/
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);
});
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 = 'Org Selected';

self._mixpanel('track', eventName, {
org: org
});
return self;
};


/**
* Track org click on /orgSelect page
* Reports to:
Expand Down
10 changes: 5 additions & 5 deletions layout.jade
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ 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<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=f.createElement("script");a.type="text/javascript";a.async=!0;a.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";e=f.getElementsByTagName("script")[0];e.parentNode.insertBefore(a,e)}})(document,window.mixpanel||[]);
mixpanel.init("57260a5b6fc972e9c69184882efd009e");

if (env === 'staging')
else
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<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=f.createElement("script");a.type="text/javascript";a.async=!0;a.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";e=f.getElementsByTagName("script")[0];e.parentNode.insertBefore(a,e)}})(document,window.mixpanel||[]);
mixpanel.init("abed31a0844a1bf389205355edfda4c2");
(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
0)))}}var d=a;"undefined"!==typeof f?d=a[f]=[]:f="mixpanel";d.people=d.people||[];d.toString=function(b){var a="mixpanel";"mixpanel"!==f&&(a+="."+f);b||(a+=" (stub)");return a};d.people.toString=function(){return d.toString(1)+".people (stub)"};k="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
for(h=0;h<k.length;h++)e(d,k[h]);a._i.push([b,c,f])};a.__SV=1.2;b=e.createElement("script");b.type="text/javascript";b.async=!0;b.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";c=e.getElementsByTagName("script")[0];c.parentNode.insertBefore(b,c)}})(document,window.mixpanel||[]);
mixpanel.init("497564c7e1dc7e803edc5d4ca8583653");

body(
ng-class = "{'modal-open': ModalService.modalLayers.length > 0 || dataApp.data.modalError.data.in || dataApp.data.modalOpen}"
Expand Down

0 comments on commit fffa377

Please sign in to comment.