Script
Author's JavaScript on a site page. A leaf with no layout: the element carries a single
<script>
tag. The tag goes to the end of the page body, in the order of the elements in the markup; site-level scripts (
settings.scripts
) come first.
Type:
leaf
Web only:
in the app the element does nothing: the app loads and runs nothing, and the markup stays shared between the app and the site.
Script src:"data/web/scripts/analytics.js" requiresConsent:"analytics"
Script src:"https://cdn.example.com/widget.js" defer:true requiresConsent:"marketing"
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
src
|
string | — |
Script address: a project file
by its full path from the root
(
data/web/scripts/…
) or an external
https://
address
|
async
|
bool | false |
The
async
attribute
|
defer
|
bool | false |
The
defer
attribute
|
id
|
string | — |
The tag's
id
attribute — for scripts that look up their own tag by name
|
attrs
|
map | — |
Other tag attributes:
{mapOf("data-domain", "example.com")}
. Allowed:
data-*
,
type
(only
module
),
integrity
,
crossorigin
|
requiresConsent
|
"analytics"
|
"marketing"
|
— | Consent category: the tag is output inert and activated only after the category is allowed (see Consent ) |
Domain gating
Author scripts run
on the site's own addresses
: on the slug address
<slug>.reeel.site
that every publication gets, and on a connected domain — a host from
domains
in
project.json
or the
settings.origin
host.
reeel.site
is a separate domain precisely for this: the author's code on the site's address shares nothing with the platform's
reeel.dev
.
On the platform's own addresses (
reeel.dev
) the tag is not output in the HTML at all, and files from
data/web/
answer 404 at their direct address.
localhost
on a published site is not an exception.
Author inserts are explicitly allowed in two places where the project belongs to whoever is looking at it:
the editor preview
and
the static export
(the pages go out with their tags, and the files
data/web/scripts/*.js
and
data/web/html/*.html
— next to them).
Consent
A script with
requiresConsent
is output inert (
<script type="reeel/consent" data-consent="…" data-src="…">
); the page activates the tags of allowed categories on load and when consent changes,
without a reload
. Withdrawing consent does not unload a script that has already run — withdrawal takes effect from the next load (a platform limitation).
Examples
Script after consent
Script src:"https://cdn.example.com/pixel.js" requiresConsent:"marketing" id:pixel
On the platform address the page goes out without the tag; on a connected domain the tag is inert until the visitor allows
marketing
— accepting runs it without a reload.
This is not how Yandex Metrica and Google Analytics are connected: the counter is declared in
`settings.analytics`
, the platform prints the snippet, and goals are sent by calling
analytics.goal("name")
.
Your own project file
Script src:"data/web/scripts/site.js" defer:true
The file
data/web/scripts/site.js
is synced with the project and served at
/data/<path>
; there is no need to declare it in the manifest.
Script configured through attributes
Script src:"https://plausible.io/js/script.js" defer:true
requiresConsent:"analytics" attrs:{mapOf("data-domain", "example.com")}
A name outside the list (
onload
,
src
, another
type
) is refused: the script is skipped with a warning.
Script for the whole site
A script that is the same on every page is declared once — in
settings.scripts
of the site configuration — and runs before the page-level
Script
elements. See
project.json
.
Rules
-
MUST
Analytics and marketing go with
requiresConsentof the matching category: the tag is what the banner promises the visitor. A third-party script (src:"https://…") without a label is an analyzer finding,script_without_consent; if the page does not work without it (payment, captcha), say so in words:requiresConsent:"necessary". -
MUST
srcis a full path from the project root (data/web/scripts/…), as forImage, orhttps://…. A bare name, a path outside the directory,.., a leading/and other schemes (javascript:,data:) are rejected, not fixed : the tag must not point outside the project. - MUST NOT There are no inline scripts in the format and there will be none: every author script is a file the project owns, or a URL the author named.
-
SHOULD
A script that works in the preview also works on the published site — both on
<slug>.reeel.siteand on a connected domain. If it does not, check the consent category first: a gated tag waits for the visitor's answer. -
MUST NOT
Do not put a third-party script on a page with
Session: the token lives in browser storage and is available to any script on the page. A widget belongs in `HtmlEmbed isolate:true` .