Add Umami Analytics integration (#44)

* Add Umami Analytics integration

* Leave empty line
This commit is contained in:
Thomas Jaskiewicz 2021-10-16 21:41:08 +02:00 committed by GitHub
parent 69c572ab0c
commit 054eff5bed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 1 deletions

View File

@ -23,3 +23,5 @@ RAZZLE_TIKTOK=https://www.tiktok.com/@technotim
RAZZLE_KIT=https://kit.co/TechnoTim RAZZLE_KIT=https://kit.co/TechnoTim
RAZZLE_FOOTER=Thanks for stopping by! RAZZLE_FOOTER=Thanks for stopping by!
RAZZLE_GA_TRACKING_ID=G-XXXXXXXXXX RAZZLE_GA_TRACKING_ID=G-XXXXXXXXXX
RAZZLE_UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RAZZLE_UMAMI_APP_URL=https://your-umami-app.com

View File

@ -25,6 +25,18 @@ Sample event for YouTube button.
}); });
``` ```
## Umami Analytics Support
See [Adding a website & Collecting data](https://umami.is/docs/collect-data) page to add and generate your tracking code.
Generated tracking code should look like:
```javascript
<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`.
## Docker ## Docker
This container image is published on both [GitHub Container Registry](https://github.com/techno-tim/littlelink-server/pkgs/container/littlelink-server) and [DockerHub](https://hub.docker.com/repository/docker/timothystewart6/littlelink-server) choose whichever one works for you. They will both be updated during CI. This container image is published on both [GitHub Container Registry](https://github.com/techno-tim/littlelink-server/pkgs/container/littlelink-server) and [DockerHub](https://hub.docker.com/repository/docker/timothystewart6/littlelink-server) choose whichever one works for you. They will both be updated during CI.
@ -97,6 +109,8 @@ services:
- GITLAB=https://www.gitlab.com/ - GITLAB=https://www.gitlab.com/
- PATREON=https://www.patreon.com/technotim - PATREON=https://www.patreon.com/technotim
- DEVTO=https://dev.to/ - DEVTO=https://dev.to/
- UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- UMAMI_APP_URL=https://your-umami-app.com
ports: ports:
- 8080:3000 - 8080:3000
restart: unless-stopped restart: unless-stopped

View File

@ -63,6 +63,8 @@ services:
- GITLAB=https://www.gitlab.com/ - GITLAB=https://www.gitlab.com/
- PATREON=https://www.patreon.com/technotim - PATREON=https://www.patreon.com/technotim
- DEVTO=https://dev.to/ - DEVTO=https://dev.to/
- UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- UMAMI_APP_URL=https://your-umami-app.com
ports: ports:
- 8080:3000 - 8080:3000

View File

@ -57,6 +57,8 @@ export const runtimeConfig =
GITLAB: window?.env?.GITLAB, GITLAB: window?.env?.GITLAB,
PATREON: window?.env?.PATREON, PATREON: window?.env?.PATREON,
DEVTO: window?.env?.DEVTO, DEVTO: window?.env?.DEVTO,
UMAMI_WEBSITE_ID: window?.env?.UMAMI_WEBSITE_ID,
UMAMI_APP_URL: window?.env?.UMAMI_APP,
} }
: { : {
// server // server
@ -197,4 +199,10 @@ export const runtimeConfig =
? process.env.PATREON ? process.env.PATREON
: process.env.RAZZLE_PATREON, : process.env.RAZZLE_PATREON,
DEVTO: nodeIsProduction ? process.env.DEVTO : process.env.RAZZLE_DEVTO, DEVTO: nodeIsProduction ? process.env.DEVTO : process.env.RAZZLE_DEVTO,
UMAMI_WEBSITE_ID: nodeIsProduction
? process.env.UMAMI_WEBSITE_ID
: process.env.RAZZLE_UMAMI_WEBSITE_ID,
UMAMI_APP_URL: nodeIsProduction
? process.env.UMAMI_APP_URL
: process.env.RAZZLE_UMAMI_APP_URL,
}; };

View File

@ -85,6 +85,14 @@ server
</script>` </script>`
: '' : ''
} }
${
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>`
: ''
}
</head> </head>
<body> <body>