The SPA shell — as DATA, not as a file with holes in it.
The document is hiccup, so writing an experiment assignment into it is
merge on an attribute map. An earlier version of this namespace kept the
shell as HTML and spliced attributes in with a regex; it rewrote a COMMENT
that happened to mention <html>, and the assignment silently never reached
the browser. That class of bug does not exist here: a map has no second place
to put a key.
Setting the arm server-side is what makes an experiment free — the stylesheet already contains every arm, so the first paint is the assigned design, with no script, no round trip, and no flash of the losing variant.
The SPA shell — as DATA, not as a file with holes in it. The document is hiccup, so writing an experiment assignment into it is `merge` on an attribute map. An earlier version of this namespace kept the shell as HTML and spliced attributes in with a regex; it rewrote a COMMENT that happened to mention `<html>`, and the assignment silently never reached the browser. That class of bug does not exist here: a map has no second place to put a key. Setting the arm server-side is what makes an experiment free — the stylesheet already contains every arm, so the first paint is the assigned design, with no script, no round trip, and no flash of the losing variant.
What the shell loads. Generated CSS first, then the storefront.
What the shell loads. Generated CSS first, then the storefront.
(document {:keys [title lang attributes stylesheets scripts]
:or {title "Store" lang "en"}})The shell as hiccup. :attributes land on <html>, which is where an
experiment arm and an explicit theme belong.
The shell as hiccup. `:attributes` land on `<html>`, which is where an experiment arm and an explicit theme belong.
(render options)The shell as a document. Escaping is hiccup's, not this namespace's.
The shell as a document. Escaping is hiccup's, not this namespace's.
(set-visitor-cookie response visitor mint?)response carrying visitor, if it was minted for this request.
SameSite=Lax and no domain: the id is for this store, and it is not a cross-site anything.
`response` carrying `visitor`, if it was minted for this request. SameSite=Lax and no domain: the id is for this store, and it is not a cross-site anything.
(visitor-of request)The visitor id request carries, or nil.
An opaque, store-assigned id — never an email, never a customer id. It exists to keep an experiment assignment stable across a session and for nothing else, which is why it is safe to put in an analytics event.
The visitor id `request` carries, or nil. An opaque, store-assigned id — never an email, never a customer id. It exists to keep an experiment assignment stable across a session and for nothing else, which is why it is safe to put in an analytics event.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |