From 1224c7d32fd2e6d4029fd34aaf6aeb3ef234d239 Mon Sep 17 00:00:00 2001
From: Aaron Pham <Aaronpham0103@gmail.com>
Date: Mon, 05 Aug 2024 19:17:11 +0000
Subject: [PATCH] refactor(comments): move script to files (#1308)
---
quartz/plugins/emitters/componentResources.ts | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts
index 81d3af2..d1d8c85 100644
--- a/quartz/plugins/emitters/componentResources.ts
+++ b/quartz/plugins/emitters/componentResources.ts
@@ -136,6 +136,22 @@
posthog.init('${cfg.analytics.apiKey}',{api_host:'${cfg.analytics.host ?? "https://app.posthog.com"}'})\`
document.head.appendChild(posthogScript)
`)
+ } else if (cfg.analytics?.provider === "tinylytics") {
+ const siteId = cfg.analytics.siteId
+ componentResources.afterDOMLoaded.push(`
+ const tinylyticsScript = document.createElement("script")
+ tinylyticsScript.src = "https://tinylytics.app/embed/${siteId}.js"
+ tinylyticsScript.defer = true
+ document.head.appendChild(tinylyticsScript)
+ `)
+ } else if (cfg.analytics?.provider === "cabin") {
+ componentResources.afterDOMLoaded.push(`
+ const cabinScript = document.createElement("script")
+ cabinScript.src = "${cfg.analytics.host ?? "https://scripts.cabin.dev"}/cabin.js"
+ cabinScript.defer = true
+ cabinScript.async = true
+ document.head.appendChild(cabinScript)
+ `)
}
if (cfg.enableSPA) {
--
Gitblit v1.10.0