Cleanup default analytics function

This commit is contained in:
Robin North
2018-01-22 19:06:45 +00:00
parent 3205596f3e
commit f559ca2914
2 changed files with 3 additions and 7 deletions

View File

@@ -272,7 +272,9 @@ Pjax.prototype = {
// Fire Events
trigger(document,"pjax:complete pjax:success", state.options)
if (typeof state.options.analytics === "function") {
state.options.analytics()
}
if (state.options.history) {
// First parse url and check for hash to override scroll

View File

@@ -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() {}
}
}