Commit
•
dddb85f
1
Parent(s):
25a7ba5
Add Plausible analytics (#779)
Browse files* Add Plausible analytics
* Update src/routes/+layout.svelte
Co-authored-by: Eliott C. <coyotte508@gmail.com>
* fix vars for plausible analytics
* Update .env.template
Co-authored-by: Eliott C. <coyotte508@gmail.com>
* revert change to PUBLIC_PLAUSIBLE_SCRIPT_URL
---------
Co-authored-by: Eliott C. <coyotte508@gmail.com>
- .env +1 -0
- .env.template +1 -0
- src/routes/+layout.svelte +13 -1
.env
CHANGED
@@ -97,6 +97,7 @@ TASK_MODEL= # name of the model used for tasks such as summarizing title, creati
|
|
97 |
PUBLIC_ORIGIN=#https://huggingface.co
|
98 |
PUBLIC_SHARE_PREFIX=#https://hf.co/chat
|
99 |
PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
|
|
|
100 |
PUBLIC_ANNOUNCEMENT_BANNERS=`[
|
101 |
{
|
102 |
"title": "Code Llama 70B is available! 🦙",
|
|
|
97 |
PUBLIC_ORIGIN=#https://huggingface.co
|
98 |
PUBLIC_SHARE_PREFIX=#https://hf.co/chat
|
99 |
PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
|
100 |
+
PUBLIC_PLAUSIBLE_SCRIPT_URL=#/js/script.js / Leave empty to disable
|
101 |
PUBLIC_ANNOUNCEMENT_BANNERS=`[
|
102 |
{
|
103 |
"title": "Code Llama 70B is available! 🦙",
|
.env.template
CHANGED
@@ -235,6 +235,7 @@ RATE_LIMIT=16
|
|
235 |
MESSAGES_BEFORE_LOGIN=5# how many messages a user can send in a conversation before having to login. set to 0 to force login right away
|
236 |
|
237 |
PUBLIC_GOOGLE_ANALYTICS_ID=G-8Q63TH4CSL
|
|
|
238 |
|
239 |
# Not part of the .env but set as other variables in the space
|
240 |
# ADDRESS_HEADER=X-Forwarded-For
|
|
|
235 |
MESSAGES_BEFORE_LOGIN=5# how many messages a user can send in a conversation before having to login. set to 0 to force login right away
|
236 |
|
237 |
PUBLIC_GOOGLE_ANALYTICS_ID=G-8Q63TH4CSL
|
238 |
+
PUBLIC_PLAUSIBLE_SCRIPT_URL="/js/script.js"
|
239 |
|
240 |
# Not part of the .env but set as other variables in the space
|
241 |
# ADDRESS_HEADER=X-Forwarded-For
|
src/routes/+layout.svelte
CHANGED
@@ -4,7 +4,11 @@
|
|
4 |
import { page } from "$app/stores";
|
5 |
import "../styles/main.css";
|
6 |
import { base } from "$app/paths";
|
7 |
-
import {
|
|
|
|
|
|
|
|
|
8 |
|
9 |
import { shareConversation } from "$lib/shareConversation";
|
10 |
import { UrlDependency } from "$lib/types/UrlDependency";
|
@@ -152,6 +156,14 @@
|
|
152 |
rel="manifest"
|
153 |
href="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/manifest.json"
|
154 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
</svelte:head>
|
156 |
|
157 |
{#if !$settings.ethicsModalAccepted}
|
|
|
4 |
import { page } from "$app/stores";
|
5 |
import "../styles/main.css";
|
6 |
import { base } from "$app/paths";
|
7 |
+
import {
|
8 |
+
PUBLIC_APP_DESCRIPTION,
|
9 |
+
PUBLIC_ORIGIN,
|
10 |
+
PUBLIC_PLAUSIBLE_SCRIPT_URL,
|
11 |
+
} from "$env/static/public";
|
12 |
|
13 |
import { shareConversation } from "$lib/shareConversation";
|
14 |
import { UrlDependency } from "$lib/types/UrlDependency";
|
|
|
156 |
rel="manifest"
|
157 |
href="{PUBLIC_ORIGIN || $page.url.origin}{base}/{PUBLIC_APP_ASSETS}/manifest.json"
|
158 |
/>
|
159 |
+
|
160 |
+
{#if PUBLIC_PLAUSIBLE_SCRIPT_URL}
|
161 |
+
<script
|
162 |
+
defer
|
163 |
+
data-domain={new URL(PUBLIC_ORIGIN).hostname}
|
164 |
+
src={PUBLIC_PLAUSIBLE_SCRIPT_URL}
|
165 |
+
></script>
|
166 |
+
{/if}
|
167 |
</svelte:head>
|
168 |
|
169 |
{#if !$settings.ethicsModalAccepted}
|