Adrien Denat commited on
add deprecated GA v3 (#158)
Browse filesFiles changed (3)
- .env+1
- src/app.html+28
- src/hooks.server.ts+8-3
15 unmodified lines16171819202115 unmodified linesPUBLIC_SEP_TOKEN=</s>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."PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable# Copy this in .env.local with and replace "hf_<token>" your HF token from https://huggingface.co/settings/token# You can also change the model from OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5 to your own model15 unmodified lines1617181920212215 unmodified linesPUBLIC_SEP_TOKEN=</s>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."PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disablePUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID=#UA-XXXXXXXX-X / Leave empty to disable# Copy this in .env.local with and replace "hf_<token>" your HF token from https://huggingface.co/settings/token# You can also change the model from OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5 to your own model
14 unmodified lines15161718192020 unmodified lines414243444514 unmodified lines// For some reason, Sveltekit doesn't let us load env variables from .env here, so we load it from hooks.server.tswindow.gaId = "%gaId%";</script>%sveltekit.head%</head>20 unmodified lines/// TODO: ask the user for their consent and update this with gtag('consent', 'update')}</script></body></html>14 unmodified lines1516171819202120 unmodified lines424344454647484950515253545556575859606162636465666768697071727314 unmodified lines// For some reason, Sveltekit doesn't let us load env variables from .env here, so we load it from hooks.server.tswindow.gaId = "%gaId%";window.gaIdDeprecated = "%gaIdDeprecated%";</script>%sveltekit.head%</head>20 unmodified lines/// TODO: ask the user for their consent and update this with gtag('consent', 'update')}</script><!-- Google Analytics v3 (deprecated on 1 July 2023) --><script>if (window.gaIdDeprecated) {(function (i, s, o, g, r, a, m) {i["GoogleAnalyticsObject"] = r;(i[r] =i[r] ||function () {(i[r].q = i[r].q || []).push(arguments);}),(i[r].l = 1 * new Date());(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);a.async = 1;a.src = g;m.parentNode.insertBefore(a, m);})(window,document,"script","https://www.google-analytics.com/analytics.js","ganalytics");ganalytics("create", window.gaIdDeprecated, "auto");ganalytics("send", "pageview");}</script></body></html>
123456716 unmodified lines242526272829303132333435import { dev } from "$app/environment";import { COOKIE_NAME } from "$env/static/private";import type { Handle } from "@sveltejs/kit";import { PUBLIC_GOOGLE_ANALYTICS_ID } from "$env/static/public";import { addYears } from "date-fns";export const handle: Handle = async ({ event, resolve }) => {16 unmodified linesconst response = await resolve(event, {transformPageChunk: (chunk) => {// For some reason, Sveltekit doesn't let us load env variables from .env in the app.html templateif (replaced || !chunk.html.includes("%gaId%")) {return chunk.html;}replaced = true;return chunk.html.replace("%gaId%", PUBLIC_GOOGLE_ANALYTICS_ID);},});1234567891016 unmodified lines2728293031323334353637383940import { dev } from "$app/environment";import { COOKIE_NAME } from "$env/static/private";import type { Handle } from "@sveltejs/kit";import {PUBLIC_GOOGLE_ANALYTICS_ID,PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID,} from "$env/static/public";import { addYears } from "date-fns";export const handle: Handle = async ({ event, resolve }) => {16 unmodified linesconst response = await resolve(event, {transformPageChunk: (chunk) => {// For some reason, Sveltekit doesn't let us load env variables from .env in the app.html templateif (replaced || !chunk.html.includes("%gaId%") || !chunk.html.includes("%gaIdDeprecated%")) {return chunk.html;}replaced = true;return chunk.html.replace("%gaId%", PUBLIC_GOOGLE_ANALYTICS_ID).replace("%gaIdDeprecated%", PUBLIC_DEPRECATED_GOOGLE_ANALYTICS_ID);},});
.env+1
src/app.html+28
src/hooks.server.ts+8-3