| @@ -41,6 +41,7 @@ page.show = (path, state) -> · 40 unmodified lines |
| 41 | currentState = context.state | 41 | currentState = context.state |
| 42 | page.dispatch(context) | 42 | page.dispatch(context) |
| 43 | context.pushState() | 43 | context.pushState() |
| | 44 | updateCanonicalLink() |
| 44 | track() | 45 | track() |
| 45 | context | 46 | context |
| 46 | | 47 | |
| @@ -50,6 +51,7 @@ page.replace = (path, state, skipDispatch, init) -> · 3 unmodified lines |
| 50 | currentState = context.state | 51 | currentState = context.state |
| 51 | page.dispatch(context) unless skipDispatch | 52 | page.dispatch(context) unless skipDispatch |
| 52 | context.replaceState() | 53 | context.replaceState() |
| | 54 | updateCanonicalLink() |
| 53 | track() unless init or skipDispatch | 55 | track() unless init or skipDispatch |
| 54 | context | 56 | context |
| 55 | | 57 | |
| @@ -177,6 +179,10 @@ onclick = (event) -> · 121 unmodified lines |
| 177 | isSameOrigin = (url) -> | 179 | isSameOrigin = (url) -> |
| 178 | url.indexOf("#{location.protocol}//#{location.hostname}") is 0 | 180 | url.indexOf("#{location.protocol}//#{location.hostname}") is 0 |
| 179 | | 181 | |
| | 182 | updateCanonicalLink = -> |
| | 183 | @canonicalLink ||= document.head.querySelector('link[rel="canonical"]') |
| | 184 | @canonicalLink.setAttribute('href', "http://#{location.host}#{location.pathname}") |
| | 185 | |
| 180 | track = -> | 186 | track = -> |
| 181 | ga?('send', 'pageview', location.pathname + location.search + location.hash) | 187 | ga?('send', 'pageview', location.pathname + location.search + location.hash) |
| 182 | _gauges?.push(['track']) | 188 | _gauges?.push(['track']) |