Skip to content

umamiAnalytics

The umamiAnalytics registry script. It loads https://cloud.umami.is/script.js for the input of the example. Call useScriptUmamiAnalytics(input, options?) from @hamur/scripts/<library> in a component, or list it under scripts.registry.umamiAnalytics to load it on every page.

Config keyscripts.registry.umamiAnalytics
FunctionuseScriptUmamiAnalytics of @hamur/scripts/<library>
Input keyswebsiteId (required), hostUrl, domains
Default triggerclient
Scripthttps://cloud.umami.is/script.js
Hostscloud.umami.is
Bundleyes: scripts.bundle: ["umamiAnalytics"]
Collection proxyyes: /_hamur/scripts/p/umami; flags on by default: none
Consentnone

Example

ts
import { defineConfig } from "hamur";
import scripts from "@hamur/scripts";

export default defineConfig({
  framework: "react",
  modules: [scripts],
  scripts: {
    registry: {
      umamiAnalytics: { websiteId: "d9b3f6f1-2a4c-4f0e-8d57-3c9e1a7b2f10" },
    },
  },
});

It loads after the app mounted and the first idle callback. List umamiAnalytics in scripts.bundle and the build serves the file from your origin with a SHA-384 integrity (see Bundling). With the script bundled, its collection requests go to /_hamur/scripts/p/umami on your origin, which forwards them to https://cloud.umami.is with the privacy flags applied; see The privacy proxy.

Every key is checked when the config loads and again in useScriptUmamiAnalytics: a wrong value stops the build with a message that starts with scripts.registry.umamiAnalytics. The registry list is on the registry page, and the shared options are in Scripts.