mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Rename metadata -> segmentation in Events table to play well with metabase
This commit is contained in:
parent
056bb6b0f4
commit
4886e8ba0e
1 changed files with 6 additions and 6 deletions
|
@ -4,8 +4,8 @@ _ = require "underscore"
|
|||
|
||||
if !Settings.analytics?.postgres?
|
||||
module.exports =
|
||||
recordEvent: (user_id, event, metadata, callback = () ->) ->
|
||||
logger.log {user_id, event, metadata}, "no event tracking configured, logging event"
|
||||
recordEvent: (user_id, event, segmentation, callback = () ->) ->
|
||||
logger.log {user_id, event, segmentation}, "no event tracking configured, logging event"
|
||||
callback()
|
||||
else
|
||||
Sequelize = require "sequelize"
|
||||
|
@ -21,22 +21,22 @@ else
|
|||
Event = sequelize.define("Event", {
|
||||
user_id: Sequelize.STRING,
|
||||
event: Sequelize.STRING,
|
||||
metadata: Sequelize.JSON
|
||||
segmentation: Sequelize.JSON
|
||||
})
|
||||
|
||||
module.exports =
|
||||
recordEvent: (user_id, event, metadata = {}, callback = (error) ->) ->
|
||||
recordEvent: (user_id, event, segmentation = {}, callback = (error) ->) ->
|
||||
if user_id? and typeof(user_id) != "string"
|
||||
user_id = user_id.toString()
|
||||
if user_id == Settings.smokeTest?.userId
|
||||
# Don't record smoke tests analytics
|
||||
return callback()
|
||||
Event
|
||||
.create({ user_id, event, metadata })
|
||||
.create({ user_id, event, segmentation })
|
||||
.then(
|
||||
(result) -> callback(),
|
||||
(error) ->
|
||||
logger.err {err: error, user_id, event, metadata}, "error recording analytics event"
|
||||
logger.err {err: error, user_id, event, segmentation}, "error recording analytics event"
|
||||
callback(error)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue