mirror of
https://github.com/Findus23/lw1.at.git
synced 2024-09-16 12:13:44 +02:00
use MatomoLiteTracker
This commit is contained in:
parent
0bcea6fad5
commit
b4a6d1f374
3 changed files with 41 additions and 46 deletions
|
@ -1,37 +1,21 @@
|
|||
import {isDebug} from "./utils"
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
_paq: paq
|
||||
__PRERENDER_INJECTED: boolean
|
||||
}
|
||||
}
|
||||
|
||||
declare type paq = [[string, unknown, unknown, unknown] | [string, unknown, unknown] | [string, unknown] | [string]]
|
||||
import {MatomoLiteTracker} from "matomo-lite-tracker/src/tracker"
|
||||
import {PerformanceMetric} from "matomo-lite-tracker/src/performancetracking"
|
||||
import {BrowserFeatures} from "matomo-lite-tracker/src/browserfeatures"
|
||||
import {enableLinkTracking} from "matomo-lite-tracker/src/linktracking"
|
||||
import {isDoNotTrackEnabled} from "matomo-lite-tracker/src/util"
|
||||
|
||||
|
||||
export function initMatomo(): void {
|
||||
if (isDebug) {
|
||||
if (isDebug|| isDoNotTrackEnabled()) {
|
||||
return
|
||||
}
|
||||
const _paq = window._paq || [] as unknown as paq
|
||||
_paq.push(['setRequestMethod', 'POST'])
|
||||
_paq.push(['enableHeartBeatTimer'])
|
||||
const matomo = new MatomoLiteTracker("https://matomo.lw1.at", 14)
|
||||
matomo.performanceMetric = new PerformanceMetric()
|
||||
|
||||
_paq.push(["setDoNotTrack", true])
|
||||
_paq.push(['disableCookies'])
|
||||
const matomoURL = "https://matomo.lw1.at/statistics"
|
||||
_paq.push(['setTrackerUrl', matomoURL + ".php"])
|
||||
_paq.push(['setSiteId', 14])
|
||||
const script = document.createElement('script')
|
||||
const firstScript = document.getElementsByTagName('script')[0]
|
||||
script.type = 'text/javascript'
|
||||
script.async = true
|
||||
script.defer = true
|
||||
script.src = matomoURL + ".js"
|
||||
if (firstScript.parentNode) {
|
||||
firstScript.parentNode.insertBefore(script, firstScript)
|
||||
}
|
||||
window._paq = _paq
|
||||
matomo.browserFeatures = new BrowserFeatures()
|
||||
|
||||
enableLinkTracking(matomo, [])
|
||||
matomo.trackPageview()
|
||||
}
|
||||
|
||||
|
|
46
package-lock.json
generated
46
package-lock.json
generated
|
@ -8,6 +8,7 @@
|
|||
"blurhash": "^1.1.5",
|
||||
"hint.css": "^2.7.0",
|
||||
"katex": "^0.15.3",
|
||||
"matomo-lite-tracker": "github:Findus23/MatomoLiteTracker",
|
||||
"milligram": "git+https://github.com/Findus23/milligram.git#0fde381605c1159f39efb5c33c9600331fec4e2e",
|
||||
"modern-normalize": "^1.1.0",
|
||||
"sanitize.css": "^13.0.0",
|
||||
|
@ -59,15 +60,15 @@
|
|||
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "17.0.25",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.25.tgz",
|
||||
"integrity": "sha512-wANk6fBrUwdpY4isjWrKTufkrXdu1D2YHCot2fD/DfWxF5sMrVSA+KN7ydckvaTCh0HiqX9IVl0L5/ZoXg5M7w==",
|
||||
"version": "17.0.27",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.27.tgz",
|
||||
"integrity": "sha512-4/Ke7bbWOasuT3kceBZFGakP1dYN2XFd8v2l9bqF2LNWrmeU07JLpp56aEeG6+Q3olqO5TvXpW0yaiYnZJ5CXg==",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.7.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
|
||||
"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
|
||||
"version": "8.7.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz",
|
||||
"integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
|
@ -651,6 +652,11 @@
|
|||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
|
||||
},
|
||||
"node_modules/matomo-lite-tracker": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "git+ssh://git@github.com/Findus23/MatomoLiteTracker.git#a079ab886fd9b699216d2cc0123914b09e9f27e4",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/milligram": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "git+ssh://git@github.com/Findus23/milligram.git#0fde381605c1159f39efb5c33c9600331fec4e2e",
|
||||
|
@ -715,9 +721,9 @@
|
|||
"integrity": "sha512-ZRwKbh/eQ6w9vmTjkuG0Ioi3HBwPFce0O+v//ve+aOq1oeCy7jMV2qzzAlpsNuqpqCBjjriM1lbtZbF/Q8jVyA=="
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.50.1",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.50.1.tgz",
|
||||
"integrity": "sha512-noTnY41KnlW2A9P8sdwESpDmo+KBNkukI1i8+hOK3footBUcohNHtdOJbckp46XO95nuvcHDDZ+4tmOnpK3hjw==",
|
||||
"version": "1.51.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.51.0.tgz",
|
||||
"integrity": "sha512-haGdpTgywJTvHC2b91GSq+clTKGbtkkZmVAb82jZQN/wTy6qs8DdFm2lhEQbEwrY0QDRgSQ3xDurqM977C3noA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
|
@ -855,15 +861,15 @@
|
|||
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "17.0.25",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.25.tgz",
|
||||
"integrity": "sha512-wANk6fBrUwdpY4isjWrKTufkrXdu1D2YHCot2fD/DfWxF5sMrVSA+KN7ydckvaTCh0HiqX9IVl0L5/ZoXg5M7w==",
|
||||
"version": "17.0.27",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.27.tgz",
|
||||
"integrity": "sha512-4/Ke7bbWOasuT3kceBZFGakP1dYN2XFd8v2l9bqF2LNWrmeU07JLpp56aEeG6+Q3olqO5TvXpW0yaiYnZJ5CXg==",
|
||||
"peer": true
|
||||
},
|
||||
"acorn": {
|
||||
"version": "8.7.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
|
||||
"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ=="
|
||||
"version": "8.7.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz",
|
||||
"integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A=="
|
||||
},
|
||||
"acorn-walk": {
|
||||
"version": "8.2.0",
|
||||
|
@ -1193,6 +1199,10 @@
|
|||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
|
||||
},
|
||||
"matomo-lite-tracker": {
|
||||
"version": "git+ssh://git@github.com/Findus23/MatomoLiteTracker.git#a079ab886fd9b699216d2cc0123914b09e9f27e4",
|
||||
"from": "matomo-lite-tracker@github:Findus23/MatomoLiteTracker"
|
||||
},
|
||||
"milligram": {
|
||||
"version": "git+ssh://git@github.com/Findus23/milligram.git#0fde381605c1159f39efb5c33c9600331fec4e2e",
|
||||
"integrity": "sha512-yEdUYKy/FnnxDW+cjoiEr7kP5O5sXWVrwWK/OFBzZBDCSByScnATVbgajLQboqR7lAr3OJGqra3ixAr4xrqJng==",
|
||||
|
@ -1238,9 +1248,9 @@
|
|||
"integrity": "sha512-ZRwKbh/eQ6w9vmTjkuG0Ioi3HBwPFce0O+v//ve+aOq1oeCy7jMV2qzzAlpsNuqpqCBjjriM1lbtZbF/Q8jVyA=="
|
||||
},
|
||||
"sass": {
|
||||
"version": "1.50.1",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.50.1.tgz",
|
||||
"integrity": "sha512-noTnY41KnlW2A9P8sdwESpDmo+KBNkukI1i8+hOK3footBUcohNHtdOJbckp46XO95nuvcHDDZ+4tmOnpK3hjw==",
|
||||
"version": "1.51.0",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.51.0.tgz",
|
||||
"integrity": "sha512-haGdpTgywJTvHC2b91GSq+clTKGbtkkZmVAb82jZQN/wTy6qs8DdFm2lhEQbEwrY0QDRgSQ3xDurqM977C3noA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"blurhash": "^1.1.5",
|
||||
"hint.css": "^2.7.0",
|
||||
"katex": "^0.15.3",
|
||||
"matomo-lite-tracker": "github:Findus23/MatomoLiteTracker",
|
||||
"milligram": "git+https://github.com/Findus23/milligram.git#0fde381605c1159f39efb5c33c9600331fec4e2e",
|
||||
"modern-normalize": "^1.1.0",
|
||||
"sanitize.css": "^13.0.0",
|
||||
|
|
Loading…
Reference in a new issue