Skip to content

Commit f13f60e

Browse files
authored
Merge pull request #2058 from CodeNow/add-events-to-new-auth
Add events to new auth
2 parents b994035 + b91bf03 commit f13f60e

File tree

8 files changed

+58
-10
lines changed

8 files changed

+58
-10
lines changed

client/config/routes.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,12 @@ module.exports = [
334334
return fetchInstancesByPod()
335335
.catch(goToStateOnError($q, $state, $timeout, 'orgSelect', 'Unauthorized'));
336336
},
337-
booted: function (eventTracking) {
338-
eventTracking.visitedContainersPage();
337+
booted: function (
338+
currentOrg,
339+
eventTracking,
340+
populateCurrentOrgService
341+
) {
342+
eventTracking.visitedContainersPage(currentOrg.isPersonalAccount());
339343
}
340344
}
341345
}, {

client/controllers/controllerApp.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function ControllerApp(
2020
debounce,
2121
demoFlowService,
2222
errs,
23+
eventTracking,
2324
featureFlags,
2425
fetchInstancesByPod,
2526
keypather,
@@ -44,6 +45,10 @@ function ControllerApp(
4445
CA.instancesByPod = instancesByPod;
4546
});
4647

48+
CA.openedFirstAuthPrimer = function () {
49+
eventTracking.openedFirstAuthPrimer();
50+
};
51+
4752
CA.showDemoRepo = function () {
4853
return ahaGuide.isAddingFirstRepo() && !ahaGuide.hasConfirmedSetup() && ahaGuide.hasDemoRepo();
4954
};

client/directives/components/newContainer/newContainerController.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function NewContainerController(
1616
currentOrg,
1717
demoFlowService,
1818
errs,
19+
eventTracking,
1920
fetchInstances,
2021
fetchInstancesByPod,
2122
fetchOwnerRepos,
@@ -74,6 +75,10 @@ function NewContainerController(
7475
loading('newContainerRepos', false);
7576
});
7677

78+
NCC.openedFirstAuthPrimer = function () {
79+
eventTracking.openedFirstAuthPrimer();
80+
};
81+
7782
NCC.fetchTemplateServers = function () {
7883
loading('newContainerTemplates', true);
7984
// Fetch all non-repo containres

client/directives/instances/instance/branchMenuPopover/templateMenuEmptyPopoverView.jade

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@
66
)
77
p.p.text-center To add your own repositories and services, try Runnable with a GitHub team.
88
button.btn.btn-sm.gray.margin-top-xs(
9+
ng-if = "!$root.featureFlags.demoPersistentAddTeam"
910
ui-sref = "orgSelect"
1011
ui-sref-opts = "{reload: true}"
1112
) Switch to a Team
13+
button.btn.btn-sm.gray.margin-top-xs(
14+
internal-modal-helper = "gitHubScopeView"
15+
ng-click = "NCC.openedFirstAuthPrimer()"
16+
ng-if = "$root.featureFlags.demoPersistentAddTeam"
17+
) Switch to a Team
1218

1319
.grid-block.align-center.vertical.padding-md.empty(
1420
ng-if = "!NCC.isPersonalAccount() && !$root.featureFlags.demoPersonalOnly"

client/directives/modals/modalChooseOrganization/chooseOrganizationModalController.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,16 @@ function ChooseOrganizationModalController(
5656

5757
COMC.grantAccess = function (isDemo) {
5858
var loadingString = 'grantAccess';
59-
if (isDemo) {
60-
loadingString = 'grantAccessDemo';
61-
}
62-
6359
var connectionUrl = '/githubAuth';
6460

6561
if (isDemo) {
62+
loadingString = 'grantAccessDemo';
6663
connectionUrl = connectionUrl + '?isDemo=true';
6764
}
65+
66+
// tracking with mixpanel
67+
eventTracking.openedSecondAuthPrimer();
68+
6869
var customWindow = customWindowService(connectionUrl, {
6970
width: 1020, // match github minimum width
7071
height: 660

client/directives/navBar/viewNav.jade

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ a.grid-block.align-center.justify-center.shrink.btn-add-team(
4040
//- with tooltip
4141
//- show for personal accounts outside the "add team step"
4242
a.grid-block.align-center.justify-center.shrink.btn-add-team(
43-
ng-click = "CA.demoAddOrg()"
43+
data-event-name = "Open First Auth Primer"
44+
internal-modal-helper = "gitHubScopeView"
45+
ng-click = "CA.openedFirstAuthPrimer()"
4446
ng-if = "$root.featureFlags.demoPersistentAddTeam"
4547
tooltip = "Add a team"
4648
tooltip-options = "{\"class\":\"right\",\"left\":42,\"top\":3}"

client/services/serviceEventTracking.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,10 @@ function EventTracking(
424424
* - mixpanel
425425
* @return this
426426
*/
427-
ETS.visitedContainersPage = function () {
427+
ETS.visitedContainersPage = function (isPersonalAccount) {
428428
var eventName = 'Visited containers page';
429429

430-
ETS._mixpanel('track', eventName);
430+
ETS._mixpanel('track', eventName, {isPersonalAccount: isPersonalAccount});
431431
return ETS;
432432
};
433433

@@ -631,6 +631,30 @@ function EventTracking(
631631
return ETS;
632632
};
633633

634+
/**
635+
* Opened auth primer (1)
636+
* Reports to:
637+
* - mixpanel
638+
* @return this
639+
*/
640+
ETS.openedFirstAuthPrimer = function () {
641+
var eventName = 'Opened First Auth Primer';
642+
ETS._mixpanel('track', eventName);
643+
return ETS;
644+
};
645+
646+
/**
647+
* Opened auth primer (2)
648+
* Reports to:
649+
* - mixpanel
650+
* @return this
651+
*/
652+
ETS.openedSecondAuthPrimer = function () {
653+
var eventName = 'Opened Second Auth Primer';
654+
ETS._mixpanel('track', eventName);
655+
return ETS;
656+
};
657+
634658
/**
635659
* Clicked ‘Change Team’
636660
* Reports to:

test/unit/directives/modals/chooseOrganizationModal/chooseOrganizationModalController.unit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ describe('ChooseOrganizationModalController', function () {
130130
eventTrackingStub = {
131131
updateCurrentPersonProfile: sinon.stub(),
132132
spunUpInfrastructure: sinon.stub(),
133-
spunUpInfrastructureForOrg: sinon.stub()
133+
spunUpInfrastructureForOrg: sinon.stub(),
134+
openedSecondAuthPrimer: sinon.stub()
134135
};
135136
return eventTrackingStub;
136137
});

0 commit comments

Comments
 (0)