Reverting 1167655f and 30ed0a0e to re-enable the analytics log handler.

This commit is contained in:
Nick Winter 2014-12-17 21:53:59 -08:00
parent 2ea47cf83b
commit fe0c89e433
3 changed files with 8 additions and 9 deletions
app/core
server

View file

@ -30,7 +30,7 @@ module.exports = class Tracker
if virtualName?
# Override title and path properties for virtual page view
# https://segment.com/docs/libraries/analytics.js/#page
properties =
properties =
title: name
path: "/#{name}"
@ -46,10 +46,10 @@ module.exports = class Tracker
# Ok to pass empty properties, but maybe not options
# TODO: What happens when we pass empty options?
if _.isEmpty options
# console.log "trackPageView without options '/#{name}'", properties, options
# console.log "trackPageView without options '/#{name}'", properties, options
analytics.page "/#{name}"
else
# console.log "trackPageView with options '/#{name}'", properties, options
# console.log "trackPageView with options '/#{name}'", properties, options
analytics.page "/#{name}", properties, options
trackEvent: (action, properties, includeIntegrations=null) =>
@ -69,11 +69,10 @@ module.exports = class Tracker
for integration in includeIntegrations
context.integrations[integration] = true
analytics?.track action, properties, context
# Log internally too. Will turn off external event logging when internal logging is sufficient.
# TODO: enable this after we figure out what's eating the server CPU
# event = new AnalyticsLogEvent event: action, properties: properties
# event.save()
event = new AnalyticsLogEvent event: action, properties: properties
event.save()
trackTiming: (duration, category, variable, label, samplePercentage=5) ->
# https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingTiming

View file

@ -1,6 +1,6 @@
module.exports.handlers =
'analytics_log_event': 'analytics/analytics_log_event_handler'
# TODO: Disabling this until we know why our app servers CPU grows out of control.
# 'analytics_log_event': 'analytics/analytics_log_event_handler'
# 'analytics_users_active': 'analytics/analytics_users_active_handler'
'article': 'articles/article_handler'
'level': 'levels/level_handler'

View file

@ -47,7 +47,7 @@ module.exports.setup = (app) ->
log.error(error)
log.error(error.stack)
# TODO: Generally ignore this error: error: Error trying db method get route analytics.log.event from undefined: Error: Cannot find module '../undefined'
unless "#{parts}" in ['analytics.log.event', 'analytics.users.active']
unless "#{parts}" in ['analytics.users.active']
hipchat.sendTowerHipChatMessage errorMessage
errors.notFound(res, "Route #{req?.path} not found.")