Spoar

Options

What createAnalytics accepts.

OptionDefaultMeaning
project, keyfrom the environmentProject slug and public key (pk_...). An empty key leaves the key query parameter out, which works only behind the proxy
endpoint/_raA same-origin path behind the proxy, or the API's /v2/events URL
consent"optional""required" holds everything until consent.grant() and then sends it
plugins[]Plugins to start with
pageviewstrueAutomatic pageviews; set false when a router adapter sends them
mode"auto""development" logs instead of sending unless endpoint is set; "auto" reads NODE_ENV
debugfalse[ra] console output; ?ra=debug switches it on in one browser and ?ra=nodebug off again, keeping the visitor id
releasenoneAttached to every event, and used to tie errors to a deploy
environmentnoneAttached to errors
beforeSendnone(event) => event | null to change or drop any event
autostarttrue in browsersfalse to call start() yourself
transportfetch and sendBeaconA custom Transport with send(envelope, unloading)

Environment

When an option is left out, the client reads JSON from the first of NEXT_PUBLIC_RA_CONFIG, PUBLIC_RA_CONFIG and VITE_RA_CONFIG that is set. Explicit options win.

On this page