Merge pull request #5382 from overleaf/tm-analytics-project-create-segmentation

Fix for project-created event segmentation data

GitOrigin-RevId: 5b8eb14a4ea03e7136c529742a183291557d2715
This commit is contained in:
Thomas 2021-10-07 14:09:52 +02:00 committed by Copybot
parent d984e3d826
commit 85adea3f50

View file

@ -34,16 +34,23 @@ const MONTH_NAMES = [
async function createBlankProject(ownerId, projectName, attributes = {}) {
const isImport = attributes && attributes.overleaf
const project = await _createBlankProject(ownerId, projectName, attributes)
const segmentation = _.pick(attributes, [
'fromV1TemplateId',
'fromV1TemplateVersionId',
])
segmentation.projectId = project._id
if (isImport) {
AnalyticsManager.recordEventForUser(ownerId, 'project-imported', {
projectId: project._id,
attributes,
})
AnalyticsManager.recordEventForUser(
ownerId,
'project-imported',
segmentation
)
} else {
AnalyticsManager.recordEventForUser(ownerId, 'project-created', {
projectId: project._id,
attributes,
})
AnalyticsManager.recordEventForUser(
ownerId,
'project-created',
segmentation
)
}
return project
}