From 4886e8ba0ec9bdcb66219cbd21d1c5a77e1937f0 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 10 Aug 2016 17:22:35 +0100 Subject: [PATCH] Rename metadata -> segmentation in Events table to play well with metabase --- .../Features/Analytics/AnalyticsManager.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/web/app/coffee/Features/Analytics/AnalyticsManager.coffee b/services/web/app/coffee/Features/Analytics/AnalyticsManager.coffee index a902005ff0..df1ba0be7c 100644 --- a/services/web/app/coffee/Features/Analytics/AnalyticsManager.coffee +++ b/services/web/app/coffee/Features/Analytics/AnalyticsManager.coffee @@ -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) )