Use Piwik integration for Astro
This commit is contained in:
parent
1e5eff3a17
commit
42791d3a42
4 changed files with 20 additions and 24 deletions
|
@ -1,11 +1,12 @@
|
||||||
import { defineConfig } from 'astro/config';
|
import { defineConfig } from 'astro/config'
|
||||||
import react from '@astrojs/react';
|
import react from '@astrojs/react'
|
||||||
import markdoc from '@astrojs/markdoc';
|
import markdoc from '@astrojs/markdoc'
|
||||||
import AutoImport from 'astro-auto-import';
|
import AutoImport from 'astro-auto-import'
|
||||||
import keystatic from '@keystatic/astro';
|
import keystatic from '@keystatic/astro'
|
||||||
import node from '@astrojs/node'
|
import node from '@astrojs/node'
|
||||||
import robotsTxt from 'astro-robots-txt'
|
import robotsTxt from 'astro-robots-txt'
|
||||||
import mdx from '@astrojs/mdx';
|
import mdx from '@astrojs/mdx'
|
||||||
|
import matomo from 'astro-matomo'
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
@ -23,6 +24,17 @@ export default defineConfig({
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
mdx(), // This must initalzied after AutoImport, not before
|
mdx(), // This must initalzied after AutoImport, not before
|
||||||
|
matomo({
|
||||||
|
enabled: import.meta.env.PROD, // Only load in production
|
||||||
|
host: "https://stats.sudovanilla.org/",
|
||||||
|
setCookieDomain: "*.sudovanilla.org",
|
||||||
|
trackerUrl: "js/", // defaults to matomo.php
|
||||||
|
srcUrl: "js/", // defaults to matomo.js
|
||||||
|
siteId: 1,
|
||||||
|
heartBeatTimer: 5,
|
||||||
|
disableCookies: true,
|
||||||
|
debug: false,
|
||||||
|
}),
|
||||||
robotsTxt({
|
robotsTxt({
|
||||||
policy: [
|
policy: [
|
||||||
{ userAgent: 'Googlebot', disallow: '/' },
|
{ userAgent: 'Googlebot', disallow: '/' },
|
||||||
|
@ -52,4 +64,4 @@ export default defineConfig({
|
||||||
port: 2014,
|
port: 2014,
|
||||||
host: true
|
host: true
|
||||||
}
|
}
|
||||||
});
|
})
|
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
@ -26,6 +26,7 @@
|
||||||
"astro": "^4.6.3",
|
"astro": "^4.6.3",
|
||||||
"astro-auto-import": "^0.4.2",
|
"astro-auto-import": "^0.4.2",
|
||||||
"astro-json-element": "^1.1.4",
|
"astro-json-element": "^1.1.4",
|
||||||
|
"astro-matomo": "^1.6.0",
|
||||||
"astro-robots-txt": "^1.0.0",
|
"astro-robots-txt": "^1.0.0",
|
||||||
"astro-useragent": "^4.0.1",
|
"astro-useragent": "^4.0.1",
|
||||||
"axios": "^1.6.8",
|
"axios": "^1.6.8",
|
||||||
|
|
|
@ -35,21 +35,4 @@ if (Astro.url.hostname === "localhost") {
|
||||||
/>
|
/>
|
||||||
<script type="module" src="/@shoelace-style/shoelace/cdn/shoelace.js"
|
<script type="module" src="/@shoelace-style/shoelace/cdn/shoelace.js"
|
||||||
></script>
|
></script>
|
||||||
{
|
|
||||||
UsePiwik ? (
|
|
||||||
<script>
|
|
||||||
var _paq = window._paq = window._paq || [];
|
|
||||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
|
||||||
_paq.push(['trackPageView']);
|
|
||||||
_paq.push(['enableLinkTracking']);
|
|
||||||
(function() {
|
|
||||||
var u="//stats.sudovanilla.org/";
|
|
||||||
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
|
||||||
_paq.push(['setSiteId', '1']);
|
|
||||||
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);
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
) : null
|
|
||||||
}
|
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in a new issue