More granular tracking, in metabase.

This commit is contained in:
Paulo Reis 2016-09-27 16:01:56 +01:00
parent 38d04e27c9
commit b6d237e189
2 changed files with 23 additions and 11 deletions

View file

@ -136,7 +136,7 @@ div(ng-if="shouldABTestHeaderLabels")
) )
a.btn.btn-full-height( a.btn.btn-full-height(
href, href,
ng-click="ui.leftMenuShown = true" ng-click="ui.leftMenuShown = true; trackABTestConversion('menu');"
tooltip='#{translate("menu")}', tooltip='#{translate("menu")}',
tooltip-placement="bottom", tooltip-placement="bottom",
tooltip-append-to-body="true", tooltip-append-to-body="true",
@ -229,7 +229,7 @@ div(ng-if="shouldABTestHeaderLabels")
tooltip="#{translate('share')}", tooltip="#{translate('share')}",
tooltip-placement="bottom", tooltip-placement="bottom",
ng-mouseenter="trackHover('share')" ng-mouseenter="trackHover('share')"
ng-click="openShareProjectModal()", ng-click="openShareProjectModal(); trackABTestConversion('share');",
ng-controller="ShareController", ng-controller="ShareController",
sixpack-convert="editor-header" sixpack-convert="editor-header"
) )
@ -237,7 +237,7 @@ div(ng-if="shouldABTestHeaderLabels")
a.btn.btn-full-height( a.btn.btn-full-height(
href, href,
ng-mouseenter="trackHover('track-changes')" ng-mouseenter="trackHover('track-changes')"
ng-click="toggleTrackChanges()", ng-click="toggleTrackChanges(); trackABTestConversion('history');",
ng-class="{ active: (ui.view == 'track-changes') }" ng-class="{ active: (ui.view == 'track-changes') }"
tooltip="#{translate('recent_changes')}", tooltip="#{translate('recent_changes')}",
tooltip-placement="bottom", tooltip-placement="bottom",
@ -250,7 +250,7 @@ div(ng-if="shouldABTestHeaderLabels")
tooltip-placement="bottom", tooltip-placement="bottom",
ng-class="{ active: ui.chatOpen }", ng-class="{ active: ui.chatOpen }",
ng-mouseenter="trackHover('chat')" ng-mouseenter="trackHover('chat')"
ng-click="toggleChat()", ng-click="toggleChat(); trackABTestConversion('chat');",
ng-controller="ChatButtonController", ng-controller="ChatButtonController",
ng-show="!anonymous", ng-show="!anonymous",
sixpack-convert="editor-header" sixpack-convert="editor-header"
@ -270,7 +270,7 @@ div(ng-if="shouldABTestHeaderLabels")
.toolbar-left .toolbar-left
a.btn.btn-full-height( a.btn.btn-full-height(
href, href,
ng-click="ui.leftMenuShown = true", ng-click="ui.leftMenuShown = true; trackABTestConversion('menu');",
sixpack-convert="editor-header" sixpack-convert="editor-header"
) )
i.fa.fa-fw.fa-bars i.fa.fa-fw.fa-bars
@ -355,7 +355,7 @@ div(ng-if="shouldABTestHeaderLabels")
a.btn.btn-full-height( a.btn.btn-full-height(
href, href,
ng-if="permissions.admin", ng-if="permissions.admin",
ng-mouseenter="trackHover('share')" ng-mouseenter="trackHover('share'); trackABTestConversion('share');"
ng-click="openShareProjectModal()", ng-click="openShareProjectModal()",
ng-controller="ShareController", ng-controller="ShareController",
sixpack-convert="editor-header" sixpack-convert="editor-header"
@ -365,7 +365,7 @@ div(ng-if="shouldABTestHeaderLabels")
a.btn.btn-full-height( a.btn.btn-full-height(
href, href,
ng-mouseenter="trackHover('track-changes')" ng-mouseenter="trackHover('track-changes')"
ng-click="toggleTrackChanges()", ng-click="toggleTrackChanges(); trackABTestConversion('history');",
ng-class="{ active: (ui.view == 'track-changes') }", ng-class="{ active: (ui.view == 'track-changes') }",
sixpack-convert="editor-header" sixpack-convert="editor-header"
) )
@ -375,7 +375,7 @@ div(ng-if="shouldABTestHeaderLabels")
href, href,
ng-class="{ active: ui.chatOpen }", ng-class="{ active: ui.chatOpen }",
ng-mouseenter="trackHover('chat')" ng-mouseenter="trackHover('chat')"
ng-click="toggleChat()", ng-click="toggleChat(); trackABTestConversion('chat');",
ng-controller="ChatButtonController", ng-controller="ChatButtonController",
ng-show="!anonymous", ng-show="!anonymous",
sixpack-convert="editor-header" sixpack-convert="editor-header"

View file

@ -44,7 +44,7 @@ define [
SafariScrollPatcher SafariScrollPatcher
) -> ) ->
App.controller "IdeController", ($scope, $timeout, ide, localStorage, event_tracking) -> App.controller "IdeController", ($scope, $timeout, ide, localStorage, sixpack, event_tracking) ->
# Don't freak out if we're already in an apply callback # Don't freak out if we're already in an apply callback
$scope.$originalApply = $scope.$apply $scope.$originalApply = $scope.$apply
$scope.$apply = (fn = () ->) -> $scope.$apply = (fn = () ->) ->
@ -73,10 +73,22 @@ define [
# Only run the header AB test for newly registered users. # Only run the header AB test for newly registered users.
_abTestStartDate = new Date(Date.UTC(2016, 8, 22)) _abTestStartDate = new Date(Date.UTC(2016, 8, 28))
_userSignUpDate = new Date(window.user.signUpDate) _userSignUpDate = new Date(window.user.signUpDate)
$scope.shouldABTestHeaderLabels = _userSignUpDate > _abTestStartDate $scope.shouldABTestHeaderLabels = _userSignUpDate < _abTestStartDate
$scope.headerLabelsABVariant = ""
if ($scope.shouldABTestHeaderLabels)
sixpack.participate "editor-header", [ "default", "labels"], (chosenVariation) ->
$scope.headerLabelsABVariant = chosenVariation
$scope.trackABTestConversion = (headerItem) ->
event_tracking.sendMB "header-label-ab-conversion", {
headerItem: headerItem,
variant: $scope.headerLabelsABVariant
}
# Tracking code. # Tracking code.
$scope.$watch "ui.view", (newView, oldView) -> $scope.$watch "ui.view", (newView, oldView) ->