Add Matomo analytics for page views
This commit is contained in:
parent
ac6ac13ec7
commit
1344064d34
@ -97,6 +97,14 @@ $(document).keyup(function (e) {
|
|||||||
|
|
||||||
router.on("routeChange", function (newRoute) {
|
router.on("routeChange", function (newRoute) {
|
||||||
console.log("Info", "Navigating to ", newRoute.path);
|
console.log("Info", "Navigating to ", newRoute.path);
|
||||||
|
if (getStorage("analytics") !== "false") {
|
||||||
|
try {
|
||||||
|
_paq.push(['setCustomUrl', newRoute.path]);
|
||||||
|
_paq.push(['trackPageView']);
|
||||||
|
} catch (ex) {
|
||||||
|
console.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function setAppTheme(theme) {
|
function setAppTheme(theme) {
|
||||||
@ -176,6 +184,27 @@ var setup = (inStorage("accountnumber") && inStorage("accountkey")) || inStorage
|
|||||||
|
|
||||||
app.init();
|
app.init();
|
||||||
|
|
||||||
|
if (getStorage("analytics") !== "false") {
|
||||||
|
try {
|
||||||
|
var _paq = window._paq = window._paq || [];
|
||||||
|
_paq.push(['enableLinkTracking']);
|
||||||
|
(function () {
|
||||||
|
var u = "https://analytics.netsyms.net/";
|
||||||
|
_paq.push(['setTrackerUrl', u + 'matomo.php']);
|
||||||
|
_paq.push(['setSiteId', '40']);
|
||||||
|
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
|
||||||
|
g.async = true;
|
||||||
|
g.src = u + 'matomo.js';
|
||||||
|
s.parentNode.insertBefore(g, s);
|
||||||
|
})();
|
||||||
|
} catch (ex) {
|
||||||
|
// skip
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("Analytics code not loaded at user request.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (setup) {
|
if (setup) {
|
||||||
router.navigate("/home");
|
router.navigate("/home");
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,6 +33,11 @@ $('.item-content[data-setting=hideaccountnag] .toggle input').on("change", funct
|
|||||||
setStorage("hideaccountnag", checked);
|
setStorage("hideaccountnag", checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.item-content[data-setting=analytics] .toggle input').on("change", function () {
|
||||||
|
var checked = $(this).prop('checked');
|
||||||
|
setStorage("analytics", checked ? "true" : "false");
|
||||||
|
});
|
||||||
|
|
||||||
function resetAccountPrompt() {
|
function resetAccountPrompt() {
|
||||||
app.dialog.confirm("Are you sure you want to log out?", function () {
|
app.dialog.confirm("Are you sure you want to log out?", function () {
|
||||||
removeFromStorage("accountnumber");
|
removeFromStorage("accountnumber");
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-100 text-align-center">
|
<div class="col-100 text-align-center">
|
||||||
<p>Privacy Info: This app doesn't track you or sell your data. We only know
|
<p>Privacy Info: This app doesn't sell your data. We do collect a small amount
|
||||||
what you actually tell us, and we only use that data to provide and
|
of analytics to help improve the app. You can opt out in the
|
||||||
improve the services we offer you.
|
app settings.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -345,7 +345,15 @@ var routes = [
|
|||||||
text: "",
|
text: "",
|
||||||
onclick: "openBrowser('https://helena.express/appterms?mtm_campaign=HelenaExpressApp')",
|
onclick: "openBrowser('https://helena.express/appterms?mtm_campaign=HelenaExpressApp')",
|
||||||
link: true
|
link: true
|
||||||
});
|
},
|
||||||
|
{
|
||||||
|
setting: "analytics",
|
||||||
|
title: "Analytics",
|
||||||
|
text: "If turned on, we'll collect some anonymous information to help improve the app. It is not sent to any third parties.",
|
||||||
|
toggle: true,
|
||||||
|
checked: getStorage("analytics") !== "false",
|
||||||
|
onclick: ""
|
||||||
|
}, );
|
||||||
resolve({
|
resolve({
|
||||||
content: compiledPages.settings({
|
content: compiledPages.settings({
|
||||||
page_title: "Settings",
|
page_title: "Settings",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user