Adrien Denat
commited on
Commit
•
5006210
1
Parent(s):
9db9b26
Gtm env var (#138)
Browse files* make GTM configurable with env var
* add missing pageview event on GTM
* only load script if env var is present + rename env var
- .env +1 -0
- src/app.html +3 -2
.env
CHANGED
@@ -15,6 +15,7 @@ PUBLIC_ASSISTANT_MESSAGE_TOKEN=<|assistant|>
|
|
15 |
PUBLIC_SEP_TOKEN=</s>
|
16 |
PUBLIC_PREPROMPT="Below are a series of dialogues between various people and an AI assistant. The AI tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable. The assistant is happy to help with almost anything, and will do its best to understand exactly what is needed. It also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer. That said, the assistant is practical and really does its best, and doesn't let caution get too much in the way of being useful."
|
17 |
PUBLIC_VERSION=0
|
|
|
18 |
# [{"endpoint": "https://api-inference.huggingface.co/models/...", authorization: "Bearer hf_<token>", weight: 1}] to load balance
|
19 |
# Eg if one endpoint has weight 2 and the other has weight 1, the first endpoint will be called twice as often
|
20 |
MODEL_ENDPOINTS=`[]`
|
|
|
15 |
PUBLIC_SEP_TOKEN=</s>
|
16 |
PUBLIC_PREPROMPT="Below are a series of dialogues between various people and an AI assistant. The AI tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable. The assistant is happy to help with almost anything, and will do its best to understand exactly what is needed. It also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer. That said, the assistant is practical and really does its best, and doesn't let caution get too much in the way of being useful."
|
17 |
PUBLIC_VERSION=0
|
18 |
+
PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
|
19 |
# [{"endpoint": "https://api-inference.huggingface.co/models/...", authorization: "Bearer hf_<token>", weight: 1}] to load balance
|
20 |
# Eg if one endpoint has weight 2 and the other has weight 1, the first endpoint will be called twice as often
|
21 |
MODEL_ENDPOINTS=`[]`
|
src/app.html
CHANGED
@@ -20,9 +20,9 @@
|
|
20 |
|
21 |
<!-- Google Tag Manager -->
|
22 |
<script>
|
23 |
-
if (
|
24 |
const script = document.createElement("script");
|
25 |
-
script.src =
|
26 |
script.async = true;
|
27 |
document.head.appendChild(script);
|
28 |
|
@@ -32,6 +32,7 @@
|
|
32 |
}
|
33 |
gtag("js", new Date());
|
34 |
/// ^ See https://developers.google.com/tag-platform/gtagjs/install
|
|
|
35 |
gtag("consent", "default", { ad_storage: "denied", analytics_storage: "denied" });
|
36 |
/// ^ See https://developers.google.com/tag-platform/gtagjs/reference#consent
|
37 |
/// TODO: ask the user for their consent and update this with gtag('consent', 'update')
|
|
|
20 |
|
21 |
<!-- Google Tag Manager -->
|
22 |
<script>
|
23 |
+
if (%sveltekit.env.PUBLIC_GOOGLE_ANALYTICS_ID%) {
|
24 |
const script = document.createElement("script");
|
25 |
+
script.src = `https://www.googletagmanager.com/gtag/js?id=${%sveltekit.env.PUBLIC_GOOGLE_ANALYTICS_ID%}`;
|
26 |
script.async = true;
|
27 |
document.head.appendChild(script);
|
28 |
|
|
|
32 |
}
|
33 |
gtag("js", new Date());
|
34 |
/// ^ See https://developers.google.com/tag-platform/gtagjs/install
|
35 |
+
gtag("config", %sveltekit.env.PUBLIC_GOOGLE_ANALYTICS_ID%);
|
36 |
gtag("consent", "default", { ad_storage: "denied", analytics_storage: "denied" });
|
37 |
/// ^ See https://developers.google.com/tag-platform/gtagjs/reference#consent
|
38 |
/// TODO: ask the user for their consent and update this with gtag('consent', 'update')
|