From a73aca8ed9c16915928206bad6fa0ccf4e9b2b8b Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sun, 05 Feb 2023 18:39:58 +0000
Subject: [PATCH] feat: switch from GA to Plausible for analytics

---
 layouts/partials/head.html       |    3 ++-
 content/notes/troubleshooting.md |   11 ++++++++---
 config.toml                      |    1 -
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/config.toml b/config.toml
index a545ed8..dbe9893 100644
--- a/config.toml
+++ b/config.toml
@@ -1,6 +1,5 @@
 baseURL = "https://quartz.jzhao.xyz/"
 languageCode = "en-us"
-googleAnalytics = "G-XYFD95KB4J"
 relativeURLs = false
 disablePathToLower = true
 ignoreFiles = [
diff --git a/content/notes/troubleshooting.md b/content/notes/troubleshooting.md
index 66eb879..79dec15 100644
--- a/content/notes/troubleshooting.md
+++ b/content/notes/troubleshooting.md
@@ -52,8 +52,13 @@
 ### My custom domain isn't working!
 Walk through the steps in [the hosting guide](notes/hosting.md) again. Make sure you wait 30 min to 1 hour for changes to take effect.
 
-### How do I setup Google Analytics?
-You can edit it in `config.toml` and either use a V3 (UA-) or V4 (G-) tag.
+### How do I setup analytics?
+Quartz by default uses [Plausible](https://plausible.io/) for analytics. 
+
+If you would prefer to use Google Analytics, you can follow this [guide in the Hugo documentation](https://gohugo.io/templates/internal/#google-analytics). 
+
+Alternatively, you can also import your Google Analytics data into Plausible by [following this guide](https://plausible.io/docs/google-analytics-import).
+
 
 ### How do I change the content on the home page?
 To edit the main home page, open `/content/_index.md`.
@@ -78,4 +83,4 @@
 ## Still Stuck?
 Quartz isn't perfect! If you're still having troubles, file an issue in the GitHub repo with as much information as you can reasonably provide. Alternatively, you can message me on [Twitter](https://twitter.com/_jzhao) and I'll try to get back to you as soon as I can.
 
-🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues)
\ No newline at end of file
+🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues)
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 57dc546..8efccb1 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -205,5 +205,6 @@
     })
   </script>
   {{end}}
+  {{ $trimmedURL := trim (index (split .Site.BaseURL "://") 1) "/" }}
+  <script defer data-domain="{{$trimmedURL}}" src="https://plausible.io/js/script.js"></script>
 </head>
-{{ template "_internal/google_analytics.html" . }}

--
Gitblit v1.10.0