Add newer Umami script link (#395)

* Add newer Umami script link

* update: custom script name

* lint: single quotes

* fix: add "`"

* lint: actually use ESlint 😂

---------

Co-authored-by: Techno Tim <timothystewart6@gmail.com>
This commit is contained in:
Ben 2023-05-12 10:47:09 -04:00 committed by GitHub
parent cf6b0a9210
commit e684a5411b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 3 deletions

View File

@ -164,7 +164,7 @@ Generated tracking code should look like:
<script async defer data-website-id="00000000-1111-2222-3333-444444444444" src="https://your-umami-app.com/umami.js"></script>
```
Use `data-website-id` as environment variable `UMAMI_WEBSITE_ID` and `src` as `UMAMI_APP_URL`.
Use `data-website-id` as environment variable `UMAMI_WEBSITE_ID`. Take the inital root host of `src` as `UMAMI_APP_URL`, and the name of the script (i.e. `umami.js` or `script.js`) as `UMAMI_SCRIPT_NAME`.
Sample event for YouTube button.

View File

@ -66,6 +66,7 @@ services:
- DEVTO=https://dev.to/
- UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- UMAMI_APP_URL=https://your-umami-app.com
- UMAMI_SCRIPT_NAME=script.js
- BUTTON_ORDER=YOUTUBE,TWITCH,TWITTER,GITHUB,INSTAGRAM,DISCORD,FACEBOOK,TIKTOK,KIT,PATREON
- PAYPAL=https://www.paypal.me/user
- SLACK=https://slack.com/

View File

@ -22,7 +22,7 @@ Generated tracking code should look like:
<script async defer data-website-id="00000000-1111-2222-3333-444444444444" src="https://your-umami-app.com/umami.js"></script>
```
Use `data-website-id` as environment variable `UMAMI_WEBSITE_ID` and `src` as `UMAMI_APP_URL`.
Use `data-website-id` as environment variable `UMAMI_WEBSITE_ID`. Take the inital root host of `src` as `UMAMI_APP_URL`, and the name of the script (i.e. `umami.js` or `script.js`) as `UMAMI_SCRIPT_NAME`.
Sample event for YouTube button.

View File

@ -61,6 +61,7 @@ export const runtimeConfig =
PATREON: window?.env?.PATREON,
DEVTO: window?.env?.DEVTO,
UMAMI_APP_URL: window?.env?.UMAMI_APP_URL,
UMAMI_SCRIPT_NAME: window?.env?.UMAMI_SCRIPT_NAME,
BUTTON_ORDER: window?.env?.BUTTON_ORDER,
PAYPAL: window?.env?.PAYPAL,
SLACK: window?.env?.SLACK,
@ -283,6 +284,9 @@ export const runtimeConfig =
UMAMI_APP_URL: nodeIsProduction
? process.env.UMAMI_APP_URL
: process.env.RAZZLE_UMAMI_APP_URL,
UMAMI_SCRIPT_NAME: nodeIsProduction
? process.env.UMAMI_SCRIPT_NAME
: process.env.RAZZLE_UMAMI_SCRIPT_NAME,
BUTTON_ORDER: nodeIsProduction
? process.env.BUTTON_ORDER
: process.env.RAZZLE_BUTTON_ORDER,

View File

@ -195,7 +195,11 @@ server
runtimeConfig.UMAMI_WEBSITE_ID && runtimeConfig.UMAMI_APP_URL
? `
<!-- Umami Analytics -->
<script async defer data-website-id="${runtimeConfig.UMAMI_WEBSITE_ID}" src="${runtimeConfig.UMAMI_APP_URL}/umami.js">
<script async defer data-website-id="${
runtimeConfig.UMAMI_WEBSITE_ID
}" src="${runtimeConfig.UMAMI_APP_URL}/${
runtimeConfig.UMAMI_SCRIPT_NAME || 'umami.js'
}">
</script>`
: ''
}