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 module.exports = class CraftingGuideRouter extends Backbone.Router
constructor: (options={})-> constructor: (options={})->
@_page = null @_page = null
@_pageControllers = {} @_pageControllers = {}
@_lastReportedHref = null @_lastReported = null
super options super options
# Backbone.Router Overrides #################################################################### # Backbone.Router Overrides ####################################################################
@@ -45,15 +45,15 @@ module.exports = class CraftingGuideRouter extends Backbone.Router
# Private Methods ############################################################################## # Private Methods ##############################################################################
_recordPageView: -> _recordPageView: ->
href = window.location.href pathname = window.location.pathname
return if @_lastReportedHref is href return if @_lastReported is pathname
@_lastReportedHref = href @_lastReported = pathname
if global.env is 'production' if global.env is 'production'
logger.info "Recording GA page view: #{href}" logger.info "Recording GA page view: #{pathname}"
ga 'send', 'pageview', href ga 'send', 'pageview', pathname
else else
logger.info "Suppressing GA page view: #{href}" logger.info "Suppressing GA page view: #{pathname}"
_setPage: (controllerName)-> _setPage: (controllerName)->
controller = @_pageControllers[controllerName] controller = @_pageControllers[controllerName]