Matomo update
This commit is contained in:
parent
699b1a7d7d
commit
d37fc8254e
0
log/gitFile.txt
Normal file
0
log/gitFile.txt
Normal file
@ -4606,13 +4606,11 @@ class Matomo {
|
|||||||
static init() {
|
static init() {
|
||||||
Matomo.isTrackingPromise = new Promise(async (resolve) => {
|
Matomo.isTrackingPromise = new Promise(async (resolve) => {
|
||||||
let shouldTrack = localStorage.getItem(Matomo.LOCAL_STORAGE_KEY);
|
let shouldTrack = localStorage.getItem(Matomo.LOCAL_STORAGE_KEY);
|
||||||
console.log(shouldTrack,Helper.isNull(shouldTrack));
|
|
||||||
if (Helper.isNull(shouldTrack)) {
|
if (Helper.isNull(shouldTrack)) {
|
||||||
shouldTrack = await Matomo._askIsTracking();
|
shouldTrack = await Matomo._askIsTracking();
|
||||||
localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, shouldTrack);
|
localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, shouldTrack);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log(shouldTrack, (shouldTrack === "1"));
|
|
||||||
shouldTrack = (shouldTrack === "1");
|
shouldTrack = (shouldTrack === "1");
|
||||||
Matomo.setTrack(shouldTrack);
|
Matomo.setTrack(shouldTrack);
|
||||||
}
|
}
|
||||||
@ -4622,7 +4620,7 @@ class Matomo {
|
|||||||
Matomo.push(['trackPageView']);
|
Matomo.push(['trackPageView']);
|
||||||
Matomo.push(['enableLinkTracking']);
|
Matomo.push(['enableLinkTracking']);
|
||||||
Matomo.push(['setTrackerUrl', Matomo.TRACK_SITE + '/piwik.php']);
|
Matomo.push(['setTrackerUrl', Matomo.TRACK_SITE + '/piwik.php']);
|
||||||
Matomo.push(['setSiteId', '1']);
|
Matomo.push(['setSiteId', Matomo.SIDE_ID]);
|
||||||
|
|
||||||
let d = document, g = d.createElement('script'), s = d.getElementsByTagName('head')[0];
|
let d = document, g = d.createElement('script'), s = d.getElementsByTagName('head')[0];
|
||||||
g.type = 'text/javascript';
|
g.type = 'text/javascript';
|
||||||
@ -4634,7 +4632,6 @@ class Matomo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async _askIsTracking() {
|
static async _askIsTracking() {
|
||||||
console.log(Matomo.TRACK_SITE + Matomo.BASE_PATH + "isTracked");
|
|
||||||
Matomo.isTrackingPromise = Matomo.query("isTracked")
|
Matomo.isTrackingPromise = Matomo.query("isTracked")
|
||||||
.then(xml => {
|
.then(xml => {
|
||||||
let textContent = xml.firstChild.textContent;
|
let textContent = xml.firstChild.textContent;
|
||||||
@ -4646,13 +4643,8 @@ class Matomo {
|
|||||||
|
|
||||||
static async query(method) {
|
static async query(method) {
|
||||||
return fetch(Matomo.TRACK_SITE + Matomo.BASE_PATH + method, {
|
return fetch(Matomo.TRACK_SITE + Matomo.BASE_PATH + method, {
|
||||||
// "method":"POST",
|
|
||||||
"mode": "cors",
|
"mode": "cors",
|
||||||
"credentials": "include",
|
"credentials": "include",
|
||||||
// "headers": {
|
|
||||||
// 'Access-Control-Allow-Origin': '*',
|
|
||||||
// 'Access-Control-Allow-Credentials': 'true',
|
|
||||||
// },
|
|
||||||
}).then(res => res.text()).then(text => (new window.DOMParser()).parseFromString(text, "text/xml"));
|
}).then(res => res.text()).then(text => (new window.DOMParser()).parseFromString(text, "text/xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4676,6 +4668,7 @@ class Matomo {
|
|||||||
Matomo.LOCAL_STORAGE_KEY = "matomoShouldTrack";
|
Matomo.LOCAL_STORAGE_KEY = "matomoShouldTrack";
|
||||||
Matomo.TRACK_SITE = "//matomo.silas.link";
|
Matomo.TRACK_SITE = "//matomo.silas.link";
|
||||||
Matomo.BASE_PATH = "/index.php?module=API&method=AjaxOptOut.";
|
Matomo.BASE_PATH = "/index.php?module=API&method=AjaxOptOut.";
|
||||||
|
Matomo.SIDE_ID = "1";
|
||||||
|
|
||||||
InitPromise.addPromise(() => {
|
InitPromise.addPromise(() => {
|
||||||
window["_paq"] = window["_paq"] || [];
|
window["_paq"] = window["_paq"] || [];
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
import {SystemSettings, Translator} from "./lib/pwa-lib";
|
import {SystemSettings, Translator} from "./lib/pwa-lib";
|
||||||
|
import {Matomo} from "./lib/pwa-assets";
|
||||||
|
|
||||||
SystemSettings.setBasePath("/");
|
SystemSettings.setBasePath("/");
|
||||||
Translator.supportedLanguages = ["de"];
|
Translator.supportedLanguages = ["de"];
|
||||||
Translator.markTranslations = false;
|
Translator.markTranslations = false;
|
||||||
Translator.markUntranslatedTranslations = false;
|
Translator.markUntranslatedTranslations = false;
|
||||||
|
|
||||||
|
Matomo.SIDE_ID = 1;
|
||||||
@ -13,13 +13,11 @@ class Matomo {
|
|||||||
static init() {
|
static init() {
|
||||||
Matomo.isTrackingPromise = new Promise(async (resolve) => {
|
Matomo.isTrackingPromise = new Promise(async (resolve) => {
|
||||||
let shouldTrack = localStorage.getItem(Matomo.LOCAL_STORAGE_KEY);
|
let shouldTrack = localStorage.getItem(Matomo.LOCAL_STORAGE_KEY);
|
||||||
console.log(shouldTrack,Helper.isNull(shouldTrack));
|
|
||||||
if (Helper.isNull(shouldTrack)) {
|
if (Helper.isNull(shouldTrack)) {
|
||||||
shouldTrack = await Matomo._askIsTracking();
|
shouldTrack = await Matomo._askIsTracking();
|
||||||
localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, shouldTrack);
|
localStorage.setItem(Matomo.LOCAL_STORAGE_KEY, shouldTrack);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log(shouldTrack, (shouldTrack === "1"));
|
|
||||||
shouldTrack = (shouldTrack === "1");
|
shouldTrack = (shouldTrack === "1");
|
||||||
Matomo.setTrack(shouldTrack);
|
Matomo.setTrack(shouldTrack);
|
||||||
}
|
}
|
||||||
@ -29,7 +27,7 @@ class Matomo {
|
|||||||
Matomo.push(['trackPageView']);
|
Matomo.push(['trackPageView']);
|
||||||
Matomo.push(['enableLinkTracking']);
|
Matomo.push(['enableLinkTracking']);
|
||||||
Matomo.push(['setTrackerUrl', Matomo.TRACK_SITE + '/piwik.php']);
|
Matomo.push(['setTrackerUrl', Matomo.TRACK_SITE + '/piwik.php']);
|
||||||
Matomo.push(['setSiteId', '1']);
|
Matomo.push(['setSiteId', Matomo.SIDE_ID]);
|
||||||
|
|
||||||
let d = document, g = d.createElement('script'), s = d.getElementsByTagName('head')[0];
|
let d = document, g = d.createElement('script'), s = d.getElementsByTagName('head')[0];
|
||||||
g.type = 'text/javascript';
|
g.type = 'text/javascript';
|
||||||
@ -41,7 +39,6 @@ class Matomo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async _askIsTracking() {
|
static async _askIsTracking() {
|
||||||
console.log(Matomo.TRACK_SITE + Matomo.BASE_PATH + "isTracked");
|
|
||||||
Matomo.isTrackingPromise = Matomo.query("isTracked")
|
Matomo.isTrackingPromise = Matomo.query("isTracked")
|
||||||
.then(xml => {
|
.then(xml => {
|
||||||
let textContent = xml.firstChild.textContent;
|
let textContent = xml.firstChild.textContent;
|
||||||
@ -53,13 +50,8 @@ class Matomo {
|
|||||||
|
|
||||||
static async query(method) {
|
static async query(method) {
|
||||||
return fetch(Matomo.TRACK_SITE + Matomo.BASE_PATH + method, {
|
return fetch(Matomo.TRACK_SITE + Matomo.BASE_PATH + method, {
|
||||||
// "method":"POST",
|
|
||||||
"mode": "cors",
|
"mode": "cors",
|
||||||
"credentials": "include",
|
"credentials": "include",
|
||||||
// "headers": {
|
|
||||||
// 'Access-Control-Allow-Origin': '*',
|
|
||||||
// 'Access-Control-Allow-Credentials': 'true',
|
|
||||||
// },
|
|
||||||
}).then(res => res.text()).then(text => (new window.DOMParser()).parseFromString(text, "text/xml"));
|
}).then(res => res.text()).then(text => (new window.DOMParser()).parseFromString(text, "text/xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +75,7 @@ class Matomo {
|
|||||||
Matomo.LOCAL_STORAGE_KEY = "matomoShouldTrack";
|
Matomo.LOCAL_STORAGE_KEY = "matomoShouldTrack";
|
||||||
Matomo.TRACK_SITE = "//matomo.silas.link";
|
Matomo.TRACK_SITE = "//matomo.silas.link";
|
||||||
Matomo.BASE_PATH = "/index.php?module=API&method=AjaxOptOut.";
|
Matomo.BASE_PATH = "/index.php?module=API&method=AjaxOptOut.";
|
||||||
|
Matomo.SIDE_ID = "1";
|
||||||
|
|
||||||
InitPromise.addPromise(() => {
|
InitPromise.addPromise(() => {
|
||||||
window["_paq"] = window["_paq"] || [];
|
window["_paq"] = window["_paq"] || [];
|
||||||
|
|||||||
9
src/js/prod.settings.js
Executable file
9
src/js/prod.settings.js
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
import {SystemSettings, Translator} from "./lib/pwa-lib";
|
||||||
|
import {Matomo} from "./lib/pwa-assets";
|
||||||
|
|
||||||
|
SystemSettings.setBasePath("/");
|
||||||
|
Translator.supportedLanguages = ["de"];
|
||||||
|
Translator.markTranslations = false;
|
||||||
|
Translator.markUntranslatedTranslations = false;
|
||||||
|
|
||||||
|
Matomo.SIDE_ID = null;
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import {SystemSettings, Translator} from "./lib/pwa-lib";
|
import {SystemSettings, Translator} from "./lib/pwa-lib";
|
||||||
|
import {Matomo} from "./lib/pwa-assets";
|
||||||
|
|
||||||
|
|
||||||
let basePath = "/pwa/wordRotator/public/";
|
let basePath = "/pwa/wordRotator/public/";
|
||||||
@ -11,4 +12,4 @@ SystemSettings.setBasePath(basePath);
|
|||||||
Translator.supportedLanguages = ["de"];
|
Translator.supportedLanguages = ["de"];
|
||||||
Translator.markTranslations = false;
|
Translator.markTranslations = false;
|
||||||
|
|
||||||
const TRACKING_ID = '';
|
Matomo.SIDE_ID = 2;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ async function afterEachTest(t) {
|
|||||||
return await t.eval(() => indexedDB.deleteDatabase('wordRotator'));
|
return await t.eval(() => indexedDB.deleteDatabase('wordRotator'));
|
||||||
}
|
}
|
||||||
|
|
||||||
let isLocal = true;
|
let isLocal = false;
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
fixture`Play`
|
fixture`Play`
|
||||||
.page`https://127.0.0.1/pwa/wordRotator/publicTest/`.beforeEach(async t => {
|
.page`https://127.0.0.1/pwa/wordRotator/publicTest/`.beforeEach(async t => {
|
||||||
@ -40,7 +40,7 @@ else {
|
|||||||
password: '20luxl200'
|
password: '20luxl200'
|
||||||
}).beforeEach(async t => {
|
}).beforeEach(async t => {
|
||||||
await beforeEachTest(t);
|
await beforeEachTest(t);
|
||||||
await t.wait(20000);
|
await t.wait(25000);
|
||||||
}).afterEach(async t => {
|
}).afterEach(async t => {
|
||||||
await afterEachTest(t);
|
await afterEachTest(t);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user