add indentify option and uuid for users not logged in

This commit is contained in:
Henry Oswald 2017-03-08 17:51:35 +00:00
parent cf896b5a5d
commit d722f47b0f
3 changed files with 13 additions and 1 deletions

View file

@ -1,7 +1,9 @@
AnalyticsManager = require "./AnalyticsManager"
AuthenticationController = require("../Authentication/AuthenticationController")
module.exports = AnalyticsController =
recordEvent: (req, res, next) ->
AnalyticsManager.recordEvent req.session?.user?._id, req.params.event, req.body, (error) ->
user_id = AuthenticationController.getLoggedInUserId(req) or req.sessionID
AnalyticsManager.recordEvent user_id, req.params.event, req.body, (error) ->
return next(error) if error?
res.send 204

View file

@ -16,6 +16,14 @@ makeRequest = (opts, callback)->
module.exports =
idendifyUser: (user_id, old_user_id, callback)->
opts =
body:
old_user_id:old_user_id
json:true
method:"POST"
timeout:1000
url: "/user/#{user_id}/idendify"
recordEvent: (user_id, event, segmentation = {}, callback = (error) ->) ->
if user_id+"" == settings.smokeTest?.userId+""

View file

@ -9,6 +9,8 @@ module.exports =
webRouter.get '/tos', HomeController.externalPage("tos", "Terms of Service")
webRouter.get '/about', HomeController.externalPage("about", "About Us")
webRouter.get '/review', HomeController.externalPage("review", "About Us")
webRouter.get '/security', HomeController.externalPage("security", "Security")
webRouter.get '/privacy_policy', HomeController.externalPage("privacy", "Privacy Policy")
webRouter.get '/planned_maintenance', HomeController.externalPage("planned_maintenance", "Planned Maintenance")