insights-js
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -246,3 +246,3 @@ 'use strict'; | ||
this.trackSinglePage(true, this.trackPageData.path); | ||
window.addEventListener("beforeunload", this.trackLastPageTimeSpent); | ||
window.addEventListener("unload", this.trackLastPageTimeSpent); | ||
return this.trackPageData.result; | ||
@@ -297,13 +297,15 @@ }; | ||
var time = this.trackPageData && this.trackPageData.time; | ||
if (!time) { | ||
if (!time || typeof navigator.sendBeacon !== "function" || this.options.disabled) { | ||
return; | ||
} | ||
var now = Date.now(); | ||
this.track({ | ||
navigator.sendBeacon("https://getinsights.io/app/tics", JSON.stringify({ | ||
id: "page-views", | ||
projectId: this.projectId, | ||
parameters: { | ||
duration: durationInterval(now - time) | ||
}, | ||
ignoreErrors: this.options.ignoreErrors || false, | ||
update: true | ||
}); | ||
})); | ||
}; | ||
@@ -310,0 +312,0 @@ return App; |
@@ -242,3 +242,3 @@ function isInBrowser() { | ||
this.trackSinglePage(true, this.trackPageData.path); | ||
window.addEventListener("beforeunload", this.trackLastPageTimeSpent); | ||
window.addEventListener("unload", this.trackLastPageTimeSpent); | ||
return this.trackPageData.result; | ||
@@ -293,13 +293,15 @@ }; | ||
var time = this.trackPageData && this.trackPageData.time; | ||
if (!time) { | ||
if (!time || typeof navigator.sendBeacon !== "function" || this.options.disabled) { | ||
return; | ||
} | ||
var now = Date.now(); | ||
this.track({ | ||
navigator.sendBeacon("https://getinsights.io/app/tics", JSON.stringify({ | ||
id: "page-views", | ||
projectId: this.projectId, | ||
parameters: { | ||
duration: durationInterval(now - time) | ||
}, | ||
ignoreErrors: this.options.ignoreErrors || false, | ||
update: true | ||
}); | ||
})); | ||
}; | ||
@@ -306,0 +308,0 @@ return App; |
@@ -248,3 +248,3 @@ (function (global, factory) { | ||
this.trackSinglePage(true, this.trackPageData.path); | ||
window.addEventListener("beforeunload", this.trackLastPageTimeSpent); | ||
window.addEventListener("unload", this.trackLastPageTimeSpent); | ||
return this.trackPageData.result; | ||
@@ -299,13 +299,15 @@ }; | ||
var time = this.trackPageData && this.trackPageData.time; | ||
if (!time) { | ||
if (!time || typeof navigator.sendBeacon !== "function" || this.options.disabled) { | ||
return; | ||
} | ||
var now = Date.now(); | ||
this.track({ | ||
navigator.sendBeacon("https://getinsights.io/app/tics", JSON.stringify({ | ||
id: "page-views", | ||
projectId: this.projectId, | ||
parameters: { | ||
duration: durationInterval(now - time) | ||
}, | ||
ignoreErrors: this.options.ignoreErrors || false, | ||
update: true | ||
}); | ||
})); | ||
}; | ||
@@ -312,0 +314,0 @@ return App; |
{ | ||
"name": "insights-js", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Javascript client for getinsights.io", | ||
@@ -45,2 +45,3 @@ "keywords": [], | ||
"rollup-plugin-typescript2": "0.24.0", | ||
"rollup-plugin-uglify": "^6.0.3", | ||
"typedoc": "^0.15.0", | ||
@@ -47,0 +48,0 @@ "typedoc-plugin-markdown": "^2.1.11", |
65924
11
1444
14