You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HelenaExpressApp/www/assets/js/reporting.js

56 lines
1.7 KiB
JavaScript

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function sendErrorReport(category, error, errordata) {
if (getStorage("analytics") !== "false" && typeof _paq !== "undefined") {
try {
if (typeof errordata == "undefined") {
_paq.push(['trackEvent', 'Error', category, error]);
} else {
_paq.push(['trackEvent', 'Error', category, error, errordata]);
}
} catch (ex) {
console.error(ex);
}
}
}
function sendActionReport(category, action, data) {
if (getStorage("analytics") !== "false" && typeof _paq !== "undefined") {
try {
if (typeof data == "undefined") {
_paq.push(['trackEvent', 'User Action', category, action]);
} else {
_paq.push(['trackEvent', 'User Action', category, action, data]);
}
} catch (ex) {
console.error(ex);
}
}
}
function trackPageView(url, title) {
if (getStorage("analytics") !== "false" && typeof _paq !== "undefined") {
try {
_paq.push(['setCustomUrl', "https://app.helena.express" + url]);
_paq.push(['setDocumentTitle', title]);
_paq.push(['trackPageView']);
} catch (ex) {
console.error(ex);
}
}
}
function privacyPromptDialog() {
app.dialog.confirm("Turn off anonymous reporting?", "Analytics", function () {
setStorage("analytics", "false");
app.toast.show({
text: "Analytics disabled.",
closeTimeout: 3000
});
});
}