Files
Homarr/apps/nextjs/src/components/layout/analytics.tsx
homarr-renovate[bot] 0ccf258a90 chore(deps): update dependency tsx to v4.11.0 (#537)
* chore(deps): update dependency tsx to v4.11.0

* fix: build not working

---------

Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com>
Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
2024-05-26 17:51:12 +02:00

16 lines
512 B
TypeScript

import Script from "next/script";
import { UMAMI_WEBSITE_ID } from "@homarr/analytics";
import { api } from "@homarr/api/server";
export const Analytics = async () => {
// For static pages it will not find any analytics data so we do not include the script on them
const analytics = await api.serverSettings.getAnalytics().catch(() => null);
if (analytics?.enableGeneral) {
return <Script src="https://umami.homarr.dev/script.js" data-website-id={UMAMI_WEBSITE_ID} defer />;
}
return <></>;
};