History

Refactor / fix page analytics

Thibaut committed 12 years ago

Commit 636fc8c1 parent a87dd251 file · +7 −4Browse files

Unified · Split

assets/javascripts/lib/page.coffee+7−4
@@ -41,8 +41,7 @@ page.show = (path, state) -> · 40 unmodified lines
41 currentState = context.state41 currentState = context.state
42 page.dispatch(context)42 page.dispatch(context)
43 context.pushState()43 context.pushState()
44 ga?('send', 'pageview', location.pathname + location.search + location.hash)44 track()
45 _gauges?.push(['track'])
46 context45 context
47 46
48page.replace = (path, state, skipDispatch, init) ->47page.replace = (path, state, skipDispatch, init) ->
@@ -51,8 +50,7 @@ page.replace = (path, state, skipDispatch, init) -> · 2 unmodified lines
51 currentState = context.state50 currentState = context.state
52 page.dispatch(context) unless skipDispatch51 page.dispatch(context) unless skipDispatch
53 context.replaceState()52 context.replaceState()
54 ga?('send', 'pageview', location.pathname + location.search + location.hash) unless init53 track() unless init or skipDispatch
55 _gauges?.push(['track'])
56 context54 context
57 55
58page.dispatch = (context) ->56page.dispatch = (context) ->
@@ -163,3 +161,8 @@ onclick = (event) -> · 104 unmodified lines
163 161
164isSameOrigin = (url) ->162isSameOrigin = (url) ->
165 url.indexOf("#{location.protocol}//#{location.hostname}") is 0163 url.indexOf("#{location.protocol}//#{location.hostname}") is 0
164
165track = ->
166 ga?('send', 'pageview', location.pathname + location.search + location.hash)
167 _gauges?.push(['track'])
168 return