Fix error when PLAUSIBLE_HOST is missing

This commit is contained in:
aura 2022-12-23 22:59:10 -05:00 committed by GitHub
parent 4a4070d423
commit 1ae9eb5387
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,7 +62,7 @@ async function handleRequest(event) {
} else {
// PLAUSIBLE_HOST should be the full URL to your Plausible Analytics instance
// e.g. https://plausible.io/
if (PLAUSIBLE_HOST !== undefined) {
if (typeof PLAUSIBLE_HOST !== 'undefined') {
const url = PLAUSIBLE_HOST + 'api/event'
const headers = new Headers()
headers.append('User-Agent', request.headers.get('User-Agent'))