Cleanup default analytics function
This commit is contained in:
4
index.js
4
index.js
@@ -272,7 +272,9 @@ Pjax.prototype = {
|
||||
// Fire Events
|
||||
trigger(document,"pjax:complete pjax:success", state.options)
|
||||
|
||||
state.options.analytics()
|
||||
if (typeof state.options.analytics === "function") {
|
||||
state.options.analytics()
|
||||
}
|
||||
|
||||
if (state.options.history) {
|
||||
// First parse url and check for hash to override scroll
|
||||
|
||||
@@ -10,9 +10,6 @@ module.exports = function(options) {
|
||||
this.options.switchesOptions = this.options.switchesOptions || {}
|
||||
this.options.history = this.options.history || true
|
||||
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
|
||||
if (window._gaq) {
|
||||
_gaq.push(["_trackPageview"])
|
||||
}
|
||||
@@ -36,7 +33,4 @@ module.exports = function(options) {
|
||||
if (!this.options.switches.body) {
|
||||
this.options.switches.body = defaultSwitches.switchElementsAlt
|
||||
}
|
||||
if (typeof options.analytics !== "function") {
|
||||
options.analytics = function() {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user