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 key | scripts.registry.umamiAnalytics |
| Function | useScriptUmamiAnalytics of @hamur/scripts/<library> |
| Input keys | websiteId (required), hostUrl, domains |
| Default trigger | client |
| Script | https://cloud.umami.is/script.js |
| Hosts | cloud.umami.is |
| Bundle | yes: scripts.bundle: ["umamiAnalytics"] |
| Collection proxy | yes: /_hamur/scripts/p/umami; flags on by default: none |
| Consent | none |
Example
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.