fixed an error when using pjax with google analytics #59

Merged
coolhihi merged 1 commits from master into master 2016-03-12 01:09:55 -05:00

View File

@@ -7,7 +7,7 @@ module.exports = function(options){
this.options.switches = this.options.switches || {}
this.options.switchesOptions = this.options.switchesOptions || {}
this.options.history = this.options.history || true
this.options.analytics = this.options.analytics || function(options) {
this.options.analytics = this.options.analytics || function() {
// options.backward or options.foward can be true or undefined
// by default, we do track back/foward hit
// https://productforums.google.com/forum/#!topic/analytics/WVwMDjLhXYk
@@ -15,7 +15,7 @@ module.exports = function(options){
_gaq.push(["_trackPageview"])
}
if (window.ga) {
ga("send", "pageview", {page: options.url, title: options.title})
ga("send", "pageview", {page: location.pathname, title: document.title})
}
}
this.options.scrollTo = (typeof this.options.scrollTo === 'undefined') ? 0 : this.options.scrollTo;