Only report path to GA

This commit is contained in:
Andrew Miner
2015-01-15 11:43:41 -08:00
parent f7fb6cd10e
commit 6562c5a4b8
+9 -9
View File
@@ -16,9 +16,9 @@ UrlParams = require './url_params'
module.exports = class CraftingGuideRouter extends Backbone.Router
constructor: (options={})->
@_page = null
@_pageControllers = {}
@_lastReportedHref = null
@_page = null
@_pageControllers = {}
@_lastReported = null
super options
# Backbone.Router Overrides ####################################################################
@@ -45,15 +45,15 @@ module.exports = class CraftingGuideRouter extends Backbone.Router
# Private Methods ##############################################################################
_recordPageView: ->
href = window.location.href
return if @_lastReportedHref is href
@_lastReportedHref = href
pathname = window.location.pathname
return if @_lastReported is pathname
@_lastReported = pathname
if global.env is 'production'
logger.info "Recording GA page view: #{href}"
ga 'send', 'pageview', href
logger.info "Recording GA page view: #{pathname}"
ga 'send', 'pageview', pathname
else
logger.info "Suppressing GA page view: #{href}"
logger.info "Suppressing GA page view: #{pathname}"
_setPage: (controllerName)->
controller = @_pageControllers[controllerName]