Browse Source

Added Matomo Analyzing and Consent

main
Philipp Lohner 10 months ago
parent
commit
fc032521c7
  1. 32
      package-lock.json
  2. 1
      package.json
  3. 9
      public/index.html
  4. 31
      src/Router.tsx
  5. 2
      src/components/Categories/Categories.tsx
  6. 7
      src/components/Privacy/Privacy.tsx

32
package-lock.json generated

@ -20,6 +20,7 @@
"node-sass": "^6.0.1",
"prettier": "^2.3.2",
"react": "^17.0.2",
"react-cookie-consent": "^6.2.4",
"react-dom": "^17.0.2",
"react-markdown": "^6.0.2",
"react-router-dom": "^5.2.0",
@ -13509,6 +13510,11 @@
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ=="
},
"node_modules/js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -17560,6 +17566,18 @@
"node": ">=10"
}
},
"node_modules/react-cookie-consent": {
"version": "6.2.4",
"resolved": "https://registry.npmjs.org/react-cookie-consent/-/react-cookie-consent-6.2.4.tgz",
"integrity": "sha512-h6coYS6P1Vv/CLL6tn6mBivtERPkKNo7ilY3vLjNnRD8bsc4+XHT3t27fqceyyW5cT1nKVO5zCdO8UFCjpBnTw==",
"dependencies": {
"js-cookie": "^2.2.1",
"prop-types": "^15.7.2"
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0"
}
},
"node_modules/react-dev-utils": {
"version": "11.0.4",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.4.tgz",
@ -33787,6 +33805,11 @@
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.4.tgz",
"integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ=="
},
"js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -36984,6 +37007,15 @@
"whatwg-fetch": "^3.4.1"
}
},
"react-cookie-consent": {
"version": "6.2.4",
"resolved": "https://registry.npmjs.org/react-cookie-consent/-/react-cookie-consent-6.2.4.tgz",
"integrity": "sha512-h6coYS6P1Vv/CLL6tn6mBivtERPkKNo7ilY3vLjNnRD8bsc4+XHT3t27fqceyyW5cT1nKVO5zCdO8UFCjpBnTw==",
"requires": {
"js-cookie": "^2.2.1",
"prop-types": "^15.7.2"
}
},
"react-dev-utils": {
"version": "11.0.4",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.4.tgz",

1
package.json

@ -16,6 +16,7 @@
"node-sass": "^6.0.1",
"prettier": "^2.3.2",
"react": "^17.0.2",
"react-cookie-consent": "^6.2.4",
"react-dom": "^17.0.2",
"react-markdown": "^6.0.2",
"react-router-dom": "^5.2.0",

9
public/index.html

@ -13,6 +13,15 @@
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Gruenes Quartett</title>
<!-- Matomo -->
<script>
</script>
<!-- End Matomo Code -->
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>

31
src/Router.tsx

@ -8,8 +8,25 @@ import Privacy from "./components/Privacy/Privacy";
import Contact from "./components/Contact/Contact";
import Categories from "./components/Categories/Categories";
import Partners from "./components/Partners/Partners";
import CookieConsent from "react-cookie-consent";
function Router() {
function allowCookie() {
let script = document.createElement("script");
script.text = `var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//analytics.av-topo.net/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '2']);
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);
})();`;
document.head.appendChild(script);
}
return (
<BrowserRouter>
<Header />
@ -34,6 +51,20 @@ function Router() {
</Route>
</Switch>
<Footer />
<CookieConsent
location="bottom"
buttonText="Einverstanden"
expires={1}
ariaAcceptLabel="Setzen von Analyse Cookie akzeptieren"
onAccept={() => allowCookie()}
>
Wir nutzen Matomo um unsere Webseite zu analysieren. Alle Informationen
werden anonymisiert erhoben. Die Weitergabe unserer Analysedaten an
Dritte ist ausgeschlossen!{" "}
<a style={{ color: "white" }} href={"/datenschutz"}>
Weitere Informationen
</a>
</CookieConsent>
</BrowserRouter>
);
}

2
src/components/Categories/Categories.tsx

@ -58,7 +58,7 @@ function Categories() {
/>
);
})}
<Link to="/partner">
<Link to="/beteiligte">
<button type="button" className="categories-button">
Zu den Beteiligten
</button>

7
src/components/Privacy/Privacy.tsx

@ -30,6 +30,13 @@ function Privacy() {
<div className="privacy-content">
<ReactMarkdown>{content}</ReactMarkdown>
</div>
<iframe
style={{ width: "100%" }}
title="matomo"
src="https://analytics.av-topo.net/index.php?module=CoreAdminHome&action=optOut&language=de&backgroundColor=&fontColor=&fontSize=&fontFamily="
>
{""}
</iframe>
</div>
);
}

Loading…
Cancel
Save