2024-10-31 19:24:40 +00:00
|
|
|
/* eslint prefer-rest-params: 0 */
|
|
|
|
|
|
2024-10-25 21:36:33 +00:00
|
|
|
import {page} from "$app/stores"
|
2026-06-08 22:33:38 +00:00
|
|
|
import {getSetting} from "@app/settings"
|
2024-10-25 21:36:33 +00:00
|
|
|
|
|
|
|
|
const w = window as any
|
|
|
|
|
|
|
|
|
|
w.plausible =
|
|
|
|
|
w.plausible ||
|
|
|
|
|
function () {
|
|
|
|
|
;(w.plausible.q = w.plausible.q || []).push(arguments)
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-21 15:27:30 +00:00
|
|
|
export const setupAnalytics = () =>
|
2024-10-25 21:36:33 +00:00
|
|
|
page.subscribe($page => {
|
2025-03-03 23:09:58 +00:00
|
|
|
if ($page.route && getSetting("report_usage")) {
|
2024-10-25 21:36:33 +00:00
|
|
|
w.plausible("pageview", {u: $page.route.id})
|
|
|
|
|
}
|
|
|
|
|
})
|