feat: Self-hosted Plausible support (#656)
* Self-hosted Plausible support
* Remove leftover import
1 files deleted
4 files modified
| | |
| | | "mdast-util-to-hast": "^13.0.2", |
| | | "mdast-util-to-string": "^4.0.0", |
| | | "micromorph": "^0.4.5", |
| | | "plausible-tracker": "^0.3.8", |
| | | "preact": "^10.19.3", |
| | | "preact-render-to-string": "^6.3.1", |
| | | "pretty-bytes": "^6.1.1", |
| | |
| | | "url": "https://github.com/sponsors/jonschlinkert" |
| | | } |
| | | }, |
| | | "node_modules/plausible-tracker": { |
| | | "version": "0.3.8", |
| | | "resolved": "https://registry.npmjs.org/plausible-tracker/-/plausible-tracker-0.3.8.tgz", |
| | | "integrity": "sha512-lmOWYQ7s9KOUJ1R+YTOR3HrjdbxIS2Z4de0P/Jx2dQPteznJl2eX3tXxKClpvbfyGP59B5bbhW8ftN59HbbFSg==", |
| | | "engines": { |
| | | "node": ">=10" |
| | | } |
| | | }, |
| | | "node_modules/preact": { |
| | | "version": "10.19.3", |
| | | "resolved": "https://registry.npmjs.org/preact/-/preact-10.19.3.tgz", |
| | |
| | | "mdast-util-to-hast": "^13.0.2", |
| | | "mdast-util-to-string": "^4.0.0", |
| | | "micromorph": "^0.4.5", |
| | | "plausible-tracker": "^0.3.8", |
| | | "preact": "^10.19.3", |
| | | "preact-render-to-string": "^6.3.1", |
| | | "pretty-bytes": "^6.1.1", |
| | |
| | | | null |
| | | | { |
| | | provider: "plausible" |
| | | host?: string |
| | | } |
| | | | { |
| | | provider: "google" |
| | |
| | | // @ts-ignore |
| | | import spaRouterScript from "../../components/scripts/spa.inline" |
| | | // @ts-ignore |
| | | import plausibleScript from "../../components/scripts/plausible.inline" |
| | | // @ts-ignore |
| | | import popoverScript from "../../components/scripts/popover.inline" |
| | | import styles from "../../styles/custom.scss" |
| | | import popoverStyle from "../../components/styles/popover.scss" |
| | |
| | | }); |
| | | });`) |
| | | } else if (cfg.analytics?.provider === "plausible") { |
| | | componentResources.afterDOMLoaded.push(plausibleScript) |
| | | const plausibleHost = cfg.analytics.host ?? "https://plausible.io" |
| | | componentResources.afterDOMLoaded.push(` |
| | | const plausibleScript = document.createElement("script") |
| | | plausibleScript.src = "${plausibleHost}/js/script.manual.js" |
| | | plausibleScript.setAttribute("data-domain", location.hostname) |
| | | plausibleScript.defer = true |
| | | document.head.appendChild(plausibleScript) |
| | | |
| | | window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) } |
| | | |
| | | document.addEventListener("nav", () => { |
| | | plausible("pageview") |
| | | }) |
| | | `) |
| | | } else if (cfg.analytics?.provider === "umami") { |
| | | componentResources.afterDOMLoaded.push(` |
| | | const umamiScript = document.createElement("script") |