Add optional Umami analytics #17
Loading…
Reference in a new issue
No description provided.
Delete branch "cc-10-umami"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds Umami as config in
src/site.json(umami.script,umami.websiteId), empty by default. When both are set, the build injects the tracker tag into every page head and the server adds the script origin toscript-srcandconnect-src. The register button carriesdata-umami-event="register".With the empty default, no tag is emitted. The CSP gains
connect-src 'self', which is equivalent to the currentdefault-srcfallback.Build and server also accept
SITE_JSON(and the buildDIST_DIR) so tests can run a configured instance without touchingsrc/.Uptime monitoring from CC-10 is not done; the owner supplies the Umami URL and website id.
data-umami-event. Update the privacy notice in this PR.registerevent counts clicks that fail validation or hit the error path, not registrations. Fire it from the success branch of the form JS withumami.track('register')instead, guarded bywindow.umami.umamiOriginkeys offumami.scriptalone, but build.js needs both script and websiteId. With only the script set, the CSP opens to that origin while no tag is emitted. Use the same condition in both places. A malformed script URL also makesnew URLthrow at startup and kill the server.port + 1can collide with another random port. Pick a fresh random port for the second server.Fixed in
8e7a08a: 1 (privacy wording), 3 (CSP now needs script and websiteId, same as build), 4 (random port). Not changed: 2. The owner asked fordata-umami-event="register"on the button and nothing else in the markup, so it counts clicks. A success-only event would need JS changes; say if wanted. A malformed script URL throwing at startup is deliberate: fail fast on bad config.