Merge pull request #1752 from overleaf/jel-trial-impression-events

Send event on mendeley/zotero trial impression

GitOrigin-RevId: a308afd063e11308297be48933ad308d9120c327
This commit is contained in:
Jessica Lawshe 2019-05-14 08:02:04 -05:00 committed by sharelatex
parent 6513cc7b7a
commit 59cce6b52e
2 changed files with 54 additions and 1 deletions

View file

@ -31,8 +31,14 @@ define(['base'], function(App) {
parent_folder() {
return ide.fileTreeManager.getCurrentFolder()
},
projectFeatures() {
return ide.$scope.project.features
},
type() {
return 'doc'
},
userFeatures() {
return ide.$scope.user.features
}
}
})
@ -120,7 +126,19 @@ define(['base'], function(App) {
'type',
'parent_folder',
'$modalInstance',
function($scope, ide, type, parent_folder, $modalInstance) {
'event_tracking',
'projectFeatures',
'userFeatures',
function(
$scope,
ide,
type,
parent_folder,
$modalInstance,
event_tracking,
projectFeatures,
userFeatures
) {
$scope.type = type
$scope.parent_folder = parent_folder
$scope.state = {
@ -129,6 +147,35 @@ define(['base'], function(App) {
}
$scope.cancel = () => $modalInstance.dismiss('cancel')
$scope.create = () => $scope.$broadcast('create')
const hasMendeleyFeature =
(projectFeatures && projectFeatures.references) ||
(projectFeatures && projectFeatures.mendeley) ||
(userFeatures && userFeatures.references) ||
(userFeatures && userFeatures.mendeley)
const hasZoteroFeature =
(projectFeatures && projectFeatures.references) ||
(projectFeatures && projectFeatures.zotero) ||
(userFeatures && userFeatures.references) ||
(userFeatures && userFeatures.zotero)
$scope.$watch('type', function() {
if ($scope.type === 'mendeley' && !hasMendeleyFeature) {
event_tracking.send(
'subscription-funnel',
'editor-click-feature',
$scope.type
)
}
if ($scope.type === 'zotero' && !hasZoteroFeature) {
event_tracking.send(
'subscription-funnel',
'editor-click-feature',
$scope.type
)
}
})
return $scope.$on('done', (e, opts = {}) => {
isBibFile = opts.name && /^.*\.bib$/.test(opts.name)
if (opts.shouldReindexReferences || isBibFile) {

View file

@ -67,8 +67,14 @@ define(['base'], App =>
parent_folder() {
return $scope.entity
},
projectFeatures() {
return ide.$scope.project.features
},
type() {
return 'doc'
},
userFeatures() {
return ide.$scope.user.features
}
}
})