Added the session recorder script to the Page protocol in the Infrastructure package.

This commit is contained in:
2026-08-13 01:19:19 +02:00
parent 3bcae4d789
commit 4bb3e9098c
2 changed files with 40 additions and 0 deletions
@@ -86,6 +86,7 @@ public extension Page {
/// The structured data is an inert data block browsers never execute it, so a site's `Content-Security-Policy` does not apply to it
/// that search engines read for the organization's name, logo, and profiles. The analytics tracker, by contrast, is an executable script the
/// policy must allow, and it is `defer`red so it never delays the page render; each behavior flag renders its `data-` attribute only when enabled.
/// When recorder mode is on, the session recorder script follows the tracker script, deferred as well and carrying only the website id.
@HTMLBuilder
var head: some HTML {
meta(
@@ -147,6 +148,17 @@ public extension Page {
value: $0.value
)
})
if let recorderScriptURL = analytics.recorderScriptURL {
script(
.defer,
.src(recorderScriptURL),
.custom(
name: "data-website-id",
value: analytics.websiteID
)
) {}
}
}
metadata