diff --git a/Makefile b/Makefile index aad9d3e..819a0b4 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ else SHELL_PORTS := endif -SHELL_ENV := -e Z -e CI -e TEST_PATIENCE -e TEST_CONCURRENCY -e TEST_TIMEOUT_SECS -e FATHOM_SITE_ID +SHELL_ENV := -e Z -e CI -e TEST_PATIENCE -e TEST_CONCURRENCY -e TEST_TIMEOUT_SECS -e ANALYTICS_TAG ifeq ($(I),lang) LANG_TAG := lang-$(L) diff --git a/backend/server.js b/backend/server.js index 3045370..63305c3 100644 --- a/backend/server.js +++ b/backend/server.js @@ -15,7 +15,7 @@ const host = process.env.HOST || "localhost"; const port = parseInt(process.env.PORT || "") || 6119; const tlsPort = parseInt(process.env.TLS_PORT || "") || 6120; const useTLS = process.env.TLS ? true : false; -const fathomSiteId = process.env.FATHOM_SITE_ID || ""; +const analyticsTag = process.env.ANALYTICS_TAG || ""; const langs = await langsPromise; const app = express(); @@ -27,7 +27,7 @@ app.get("/", (_, res) => { if (Object.keys(langs).length > 0) { res.render(path.resolve("frontend/pages/index"), { langs, - fathomSiteId, + analyticsTag, }); } else { res @@ -61,7 +61,7 @@ app.get("/:lang", (req, res) => { } res.render(path.resolve("frontend/pages/app"), { config: langs[lang], - fathomSiteId, + analyticsTag, }); }); app.use("/css", express.static("frontend/styles")); diff --git a/doc/selfhosting.md b/doc/selfhosting.md index 60f62f2..35ef4ab 100644 --- a/doc/selfhosting.md +++ b/doc/selfhosting.md @@ -263,9 +263,9 @@ enable all the fun CloudFlare options you'd like. ## Set up analytics (optional) -Sign up for Fathom Analytics, enter your domain name, and get a site -ID. Set this as `FATHOM_SITE_ID` in your `.env` file, and build and -roll out a new web AMI. +Sign up for Fathom Analytics, enter your domain name, and get a tag +for embedding. Set this as `ANALYTICS_TAG` in your `.env` file (don't +forget the appropriate quoting), and build and roll out a new web AMI. ## Set up monitoring (optional) diff --git a/frontend/pages/app.ejs b/frontend/pages/app.ejs index b2db5a3..495d279 100644 --- a/frontend/pages/app.ejs +++ b/frontend/pages/app.ejs @@ -22,8 +22,8 @@ window.rijuConfig = <%- JSON.stringify(config) %>; - <% if (fathomSiteId) { %> - + <% if (analyticsTag) { %> + <%= analyticsTag %> <% } %>
diff --git a/frontend/pages/index.ejs b/frontend/pages/index.ejs index 77c1830..fe25f16 100644 --- a/frontend/pages/index.ejs +++ b/frontend/pages/index.ejs @@ -30,8 +30,8 @@ <% } else { %> Riju is loading language configuration... <% } %> - <% if (fathomSiteId) { %> - + <% if (analyticsTag) { %> + <%= analyticsTag %> <% } %>