Search by

three_oh_eight / laravel-fulmo

webpatser

Laravel forwarder for Fulmo: consent banner, signed analytics beacons and consent proof delivery

Package info

github.com/Three-Oh-Eight/laravel-fulmo

pkg:composer/three_oh_eight/laravel-fulmo

Statistics

Installs: 120

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.6.1 2026-11-29 14:36 UTC

This package is auto-updated.

Last update: 2026-11-29 14:37:44 UTC


README

Laravel forwarder for Fulmo, the privacy-first web analytics platform.

Latest Version Tests License

What it does

The package receives Fulmo tracker beacons and consent proofs on your own domain, so the browser only ever talks to your origin. It resolves the consent tier of each visitor, and forwards one signed event per delivery to a Fulmo instance. It also ships the consent banner bundle and a Blade component that loads the tracker only after the visitor grants the Analytics category.

Requirements

  • PHP 8.5 or higher
  • Laravel 13 illuminate/* components (bus, cache, console, contracts, cookie, database, http, queue, routing, support, translation, view)
  • A queue worker, unless you use the after_response or sync dispatch mode
  • A cache store (rate limiters and the circuit breaker use it; it must be shared between your web and worker processes)

Install

composer require three_oh_eight/laravel-fulmo

Publish what you need:

php artisan vendor:publish --tag=fulmo-config
php artisan vendor:publish --tag=fulmo-migrations
php artisan vendor:publish --tag=fulmo-lang
php artisan vendor:publish --tag=fulmo-views
Tag Publishes to
fulmo-config config/fulmo-forwarder.php
fulmo-migrations database/migrations (the consent_outbox table)
fulmo-lang lang/vendor/fulmo
fulmo-views resources/views/vendor/fulmo
fulmo-assets Deprecated since 0.6.1: public/vendor/fulmo (a copy of the consent bundle and VERSION) that nothing references any more

No JavaScript has to be published: every script is served by the package's own routes (see One call for every script), so composer update alone ships new JavaScript. The migrations are publish-only and are never loaded automatically: run php artisan migrate after publishing them if you use the outbox consent proof mode (the default).

Set the environment variables:

FULMO_TRACKER_ENABLED=true
FULMO_TRACKER_SITE=example.com
FULMO_CONSENT_URL=https://fulmo.example.com
FULMO_CONSENT_SOURCE_ID=example-site
FULMO_CONSENT_SECRET=your-shared-secret

FULMO_CONSENT_URL is the root of your Fulmo instance without a trailing path. FULMO_CONSENT_SOURCE_ID must match ^[a-z0-9-]{1,32}$ and be known to Fulmo, together with the secret. With any of the three transport values empty, nothing is sent.

Routes

Call Fulmo::routes() from routes/web.php (or any route file) outside the web middleware group. The beacons are sent without credentials, so session and CSRF middleware must not run.

use ThreeOhEight\Fulmo\Facades\Fulmo;

Fulmo::routes();
Name Method and URI Purpose
fulmo.event POST {prefix}/e Tracker beacon
fulmo.config GET {prefix}/config Configuration for track.js and the banner
fulmo.track GET {prefix}/track.js The bundled track.js, while the tracker is on
fulmo.consent.script GET {consent_prefix}/consent.js The bundled consent banner, while the consent side is on
fulmo.consent.config GET {consent_prefix}/config Banner configuration, resolved per visitor geo
fulmo.consent.log POST {consent_prefix}/consent-log Consent proof from the banner

With the defaults these are /fulmo/e, /fulmo/config, /consent/config and /consent/consent-log.

  • routes.prefix and routes.consent_prefix change the URI prefixes.
  • routes.without_middleware is a list of middleware class names stripped from the two POST routes. Use it when your application applies session, CSRF or similar middleware globally.
  • Every route runs EnsureEnabled first, which answers 404 while that route's side is off: fulmo.event while enabled (the tracker) is false, the two fulmo.consent.* routes while consent.enabled is false, and fulmo.config only when both are false. The consent routes are served with the tracker off, so a site can show the banner and collect consent proofs without tracking. The two POST routes also run RejectOversizedBody and a rate limiter.

CSRF exception

If the two POST routes end up behind CSRF verification (for example your app appends the middleware to every route), either list the CSRF middleware class in routes.without_middleware, or add a CSRF exception for them. With the defaults the paths to exempt are:

fulmo/e
consent/consent-log

Adjust them if you changed the prefixes. Register them in bootstrap/app.php:

use Illuminate\Foundation\Configuration\Middleware;

->withMiddleware(function (Middleware $middleware): void {
    $middleware->preventRequestForgery(except: [
        'fulmo/e',
        'consent/consent-log',
    ]);
})

Consent cookie

The banner bundle writes the fulmo_consent cookie from JavaScript, in plain text. The package registers EncryptCookies::except('fulmo_consent') in its service provider, so you do not need to add this exception yourself.

Config reference

All keys live in config/fulmo-forwarder.php.

Top level

Key Default Meaning
enabled env('FULMO_TRACKER_ENABLED', false) Tracker switch. Gates the beacon route (404 when off), the inline loader that injects track.js and Fulmo::cspSources(). The consent side has its own switch, consent.enabled.
site env('FULMO_TRACKER_SITE', '') Host only, no scheme. The tag's data-site and the only s a beacon or consent proof may carry.
script_url null The track.js injected after the visitor grants Analytics. null (or empty) injects the copy this package ships, first-party at GET {prefix}/track.js with ?v= and its content hash. Set a URL such as https://fulmo.io/js/track.js to inject an external track.js instead, see The track.js version.

script_version

Key Default Meaning
enabled env('FULMO_SCRIPT_VERSION_ENABLED', true) Only for an external script_url: appends ?v= with track.js's content version as Fulmo publishes it. false injects script_url as configured and never asks Fulmo. The bundled track.js ignores this block.
ttl 600 Seconds a fetched version is kept before it is checked again.
url null Where the version is published. null means script_url without its query plus .version, so https://fulmo.io/js/track.js.version.

routes

Key Default Meaning
prefix fulmo URI prefix of the beacon and config routes.
consent_prefix consent URI prefix of the consent banner routes.
without_middleware [] Middleware stripped from the two POST routes.
max_body_bytes 16384 A declared Content-Length above it answers 413; without a declared length the body itself is measured, with the same 413.
global_body_guard env('FULMO_GLOBAL_BODY_GUARD', true) Prepends the same Content-Length check (GuardFulmoBodySize) to the application's global middleware stack, so an oversized Fulmo body (the beacon, the consent-log and the three recording endpoints, each with its own limit) is refused with 413 before TrimStrings parses it, even when a feature is off. Set it to false only when the app runs its own global guard; an app that already has one can drop it and rely on this. The route-level check stays either way.

limits

Requests per minute.

Key Default Meaning
tracker_per_ip 120 Beacons per address (an IPv6 /64 counts as one).
tracker_global 600 Beacons from all visitors together.
consent_log_per_ip 20 Consent proofs per address.
consent_log 100 Consent proofs from all visitors together.

transport

Key Default Meaning
driver http Reserved. Replace the transport through the contracts, see Custom transports.
url env('FULMO_CONSENT_URL', '') Fulmo root. Events go to {url}/webhook/analytics, proofs to {url}/webhook/consent.
source_id env('FULMO_CONSENT_SOURCE_ID', '') Sent as X-Consent-Source.
secret env('FULMO_CONSENT_SECRET', '') HMAC key shared with Fulmo.
timeout 3 Request timeout in seconds.
connect_timeout 2 Connect timeout in seconds.
recording_timeout 15 Request timeout in seconds for recordings (heatmaps, forms, replay).
circuit_breaker_seconds 60 Sending pauses this long after a connection failure.

A plain http:// URL is refused outside the local and testing environments, because the bodies carry visitor data and the signature would be readable on the wire.

dispatch

Key Default Meaning
mode queue queue, after_response or sync.
connection null Queue connection, null for the application default.
queue null Queue name, null for the application default.

consent

Key Default Meaning
enabled env('FULMO_CONSENT_ENABLED', true) Consent switch. Gates the banner bundle tag and the consent/config and consent/consent-log routes (404 when off), independently of the tracker.
max_tier 2 Highest consent tier a beacon may carry (0 to 2).
minimum_strategy env('FULMO_CONSENT_MINIMUM_STRATEGY') (null) Floor under the regional consent strategy: strict_optin, eu_standard, us_optout, notice_only or default, strictest first. Each visitor gets the stricter of their regional strategy and the floor, and every strategy field of the consent config (strategy, banner fields, requireConsent, collect), the default tier and the beacon flags follow it; country, state, region and lawLabel stay the visitor's, so the consent proof keeps the visitor's country. GPC and max_tier still cap on top. null (or empty) keeps the regional rules alone; any other value fails closed to strict_optin. A controller established in the EU/EEA is bound by its own cookie law (for example the Dutch Telecommunicatiewet art. 11.7a) for visitors anywhere, so set eu_standard there.
categories ['a', 'om', 'dl'] Optional categories the site offers, a subset of a, sd, om, dl, utm, mk. core is implied. If the value is not an array, all categories but mk apply.
never_offered [] Categories never shown, whatever categories says.
proof outbox outbox or after_response, see Consent proof.
outbox_cap 50000 Undelivered outbox rows allowed before the endpoint answers 503.
batch 50 Rows the forward command takes at a time.
run_seconds 45 Time budget of one command run.
retention_days 30 Forwarded or refused rows are pruned after this many days.
pending_retention_days 14 Never delivered rows are pruned after this many days.
cookieless_visitor_hash env('FULMO_COOKIELESS_VISITOR_HASH', false) Off: no event carries the visitor's IP address or user agent, at any tier. On: tier 0 events (no consent) carry ip and ua so Fulmo can derive a daily rotating visitor hash and discard them. That is personal data sent without consent; enable it only with a legal basis and a matching privacy statement.
trusted_geo_headers ['country' => 'CF-IPCountry', 'region' => 'CF-Region-Code'] Header names carrying the visitor's ISO 3166-1 alpha-2 country and two-letter region. region may be null. Honoured only from a trusted proxy.

banner

Key Default Meaning
locale null Banner language, null follows the application locale.
accent null Accent colour as #rrggbb.
privacy_url null Privacy policy link, null hides it.
imprint_url null Imprint link, null hides it.
forget_url null Link to a page where visitors can withdraw consent and ask for their data to be deleted, for example https://fulmo.example.com/forget; null hides it. Use an https:// URL or a path starting with a single /. The bundle appends domain (the site), return (the current path, without query or fragment), host (the host the visitor is on, www. or bare) and, when the visitor has a tracker id (from consent tier 1), id, each unless the URL already carries it.

csp_nonce

Default null. See Blade component and CSP nonce.

Dispatch modes

dispatch.mode decides when a beacon is delivered. The beacon endpoint always answers 204, whatever happens.

Mode Behaviour Event serialized?
queue ForwardEvent is queued. Needs a worker. Yes
after_response The job runs after the response is sent, in the same process. No worker needed. Yes, through the job machinery
sync ForwardEvent::handle() is called directly inside the request. Never

ForwardEvent and ForwardConsentProof implement ShouldBeEncrypted, so a tier 0 event carrying ip and ua (only with consent.cookieless_visitor_hash on) never sits in plaintext in the queue store or in failed_jobs. The consequence: queued payloads are encrypted with APP_KEY, and jobs queued before a key rotation cannot be decrypted afterwards. Drain the queue before rotating the key. Alternatively list the old key in APP_PREVIOUS_KEYS. Every worker needs the same APP_KEY as the web process, or it cannot decrypt the jobs.

sync is the only mode in which the event is never serialized. Use it with an in-process transport.

Consent proof

The banner posts every visitor choice to POST {consent_prefix}/consent-log. consent.proof decides what happens next.

  • outbox (default): the record is stored in the consent_outbox table and a scheduled command forwards it, so a Fulmo outage loses nothing. At consent.outbox_cap undelivered rows the endpoint answers 503 and stores nothing; the banner retries. Needs the published migration.
  • after_response: the record is sent once after the response is out. If delivery fails the proof is dropped, so use outbox when you cannot lose proofs.

The endpoint answers 202 when accepted, 204 when silently refused (wrong site or invalid body), 413 when the body (its declared Content-Length, else its measured length) is above the limit, and 503 when not stored.

Scheduler

Add both entries to routes/console.php:

use Illuminate\Support\Facades\Schedule;
use ThreeOhEight\Fulmo\Models\ConsentOutbox;

Schedule::command('fulmo:forward-consent')
    ->everyMinute()
    ->withoutOverlapping();

Schedule::command('model:prune', ['--model' => ConsentOutbox::class])
    ->daily();

fulmo:forward-consent delivers rows in batches of consent.batch until nothing is due or consent.run_seconds have passed. Each row keeps its own delivery id across retries. A 400, 413 or 422 answer is final (the row is marked refused and logged); any other failure is retried with exponential backoff from one minute up to six hours. A connection failure, a 429 or a 5xx ends the run early.

Blade component and CSP nonce

One call for every script

Place one call in the <head> of every visitor layout:

<x-fulmo::scripts />

@fulmoScripts and {{ Fulmo::scripts() }} render the same tags. That is all the JavaScript setup there is: the config decides which features load, the visitor's consent decides when.

Script Route Rendered while Loaded
Consent bundle GET {consent_prefix}/consent.js consent.enabled at once, as a defer tag
track.js GET {prefix}/track.js (or script_url) enabled and a site after the Analytics (a) grant
Performance module GET {prefix}/perf.js also performance.enabled by track.js from data-perf, when consent was stored before the page started
Heatmaps, form analytics, session replay GET {prefix}/heatmap.js, forms.js, replay.js also heatmap.enabled, forms.enabled, replay.enabled after the Analytics and Recordings (a and rec) grant

The call renders the consent bundle tag and one inline loader. Before a choice nothing else loads beyond what the strategy default allows. The loader injects each script at most once per page, with its nonce, data-site and data-base, as soon as its categories are granted, also when the grant happens on the page; a revoke stops track.js and its storage keys go, and the recording scripts stop themselves on fulmo:consent:cleared. A feature that is off appears nowhere on the page, and no gated script has a src in the HTML, so nothing can fetch it early. The bundle tag renders while consent.enabled is true, whether the tracker is on or not; the loader renders while enabled is true and a site is set, and without the bundle it never injects anything. With both switches off nothing renders. Both tags carry the nonce when one is configured.

The tags render once per request: a second call in the same request (a layout and a partial that both carry it) renders nothing.

<x-fulmo::tracker /> is deprecated since 0.6.1 and renders exactly the same tags, under the same once-per-request guard, so existing layouts keep working. A published fulmo-views copy of tracker.blade.php keeps its old markup: delete it (or republish) to pick up the new one.

Versioned asset URLs

Every URL the package emits for a file it ships carries ?v= and a content version: the first 12 hex characters of the file's sha256. A new release therefore gets a new URL, and CDNs and browsers that cache static files for a year fetch it at once; no manual purge is needed. Every route answers a request under the current version with Cache-Control: public, max-age=31536000, immutable, and any other request (no ?v=, or an old one) with a five minute max-age, so a CDN never pins old content to a new URL.

  • The consent bundle (Fulmo::consentScriptUrl(), served at GET {consent_prefix}/consent.js) is versioned by the vendored public/fulmo-consent.min.js. A copy published to public/vendor/fulmo by an older release is no longer referenced; delete it.
  • The recording scripts (Fulmo::recordingScriptUrl(), Fulmo::recordingScriptUrls() for every enabled one) are versioned by their vendored files.
  • The performance module (Fulmo::performanceScriptUrl(), the data-perf value) is versioned by the vendored public/fulmo-perf.min.js.
  • The bundled track.js (Fulmo::trackerScriptUrl() while script_url is null, served at GET {prefix}/track.js) is versioned by the vendored public/fulmo-track.min.js, like the performance module. It is served from the package, not published, so a composer update is all it takes.
  • An external track.js (script_url set) is versioned by Fulmo, see below.

Each shipped file is hashed once per process (Fulmo::assetVersion($path)). Under Octane or another long-running worker, restart the workers after an upgrade, as on any deploy.

The track.js version

This section applies only when script_url points at an external track.js. The bundled copy changes with a package release (its public/VERSION names the Fulmo commit it was built from) and is versioned by its content hash.

An external track.js lives on Fulmo, which serves it with a one year max-age behind a CDN, and it changes without a package release. Fulmo therefore publishes the script's content version next to it, at {script_url}.version (https://fulmo.io/js/track.js.version), as {"version":"0123456789ab"} with a short max-age. The loader injects https://fulmo.io/js/track.js?v=0123456789ab, so a new track.js reaches browsers and the CDN within script_version.ttl seconds, with no release and nothing to do on your site.

  • Rendering never waits for Fulmo. The version is read from your app cache; when the entry is older than script_version.ttl (default 10 minutes), the page renders with the last known version and one refresh runs after the response (Laravel's defer()), behind a cache lock so concurrent requests never stampede Fulmo, with a 2 second timeout.
  • A timeout, a 5xx or an unusable answer keeps the last known version (kept without expiry) and is retried after at most a minute. Without a known version, the URL is used bare.
  • A 404 means the source does not exist (an older Fulmo, or a custom script_url whose host publishes no version): the bare URL, checked again after one ttl.
  • A custom script_url is versioned from {script_url}.version on its own host, or from script_version.url; a relative or protocol-relative script_url is used bare.
  • Fulmo::cspSources() keeps returning the bare script_url: CSP source matching ignores the query string, so ?v= needs no policy change.

The component renders the URL from Fulmo::trackerScriptUrl(). A published fulmo-views copy needs var scriptUrl = @js($fulmo->trackerScriptUrl()); in the loader to pick it up.

CSP nonce

Set csp_nonce to a callable or a class name. It is resolved from the container at render time and must return the nonce string of the current request; an empty answer means no nonce.

// config/fulmo-forwarder.php
'csp_nonce' => App\Support\CspNonce::class,

Fulmo::cspSources() returns the origins your policy must allow for a directive. For script-src it returns the exact track.js URL while the tracker is enabled with an external script_url, and an empty list otherwise (the bundled track.js is same-origin, so 'self' covers it) or for any other directive:

$scriptSrc = ["'self'", ...Fulmo::cspSources('script-src')];

Beacons go to your own origin, so connect-src 'self' already covers them.

Banner and languages

Forget link on your own pages

window.FulmoConsent.forgetUrl() returns the banner's forget link: banner.forget_url with domain (the site), return (the current path, where the forget page sends the visitor back), host (the host the visitor is on) and, when a tracker id exists, id appended, each unless the URL already carries it. It returns "" when the link is hidden. The URL comes from the consent config, so call it once the bundle has reported a choice, for example on a cookie page:

<a id="forget-me" hidden>Delete my data</a>
<script>
document.addEventListener('DOMContentLoaded', () => FulmoConsent.onConsent(() => {
    const url = FulmoConsent.forgetUrl(), link = document.getElementById('forget-me');
    link.hidden = url === ''; if (url) link.href = url; }));
</script>

The bundle tag is deferred, so FulmoConsent exists only from DOMContentLoaded on. Add the nonce to that inline script when your CSP requires one.

Banner and languages

Configure the banner through the banner block. The shipped texts are in English (en), Dutch (nl), German (de) and French (fr), in resources/lang/{locale}/consent_banner.php. Publish fulmo-lang to override them. Which banner type a visitor sees follows their geo regime.

Custom transports

Delivery goes through two contracts in ThreeOhEight\Fulmo\Contracts:

interface EventTransport
{
    public function send(array $event, string $deliveryId): TransportResult;
}

interface ConsentProofTransport
{
    public function sendProof(array $record, string $deliveryId): TransportResult;
}

The default HttpTransport implements both. Replace either with Fulmo::transportUsing(), typically from a service provider's boot(). Each closure receives the container:

use Illuminate\Contracts\Container\Container;

Fulmo::transportUsing(
    events: fn (Container $app) => $app->make(MyEventTransport::class),
    proofs: fn (Container $app) => $app->make(MyProofTransport::class),
);

Both arguments are optional. A plain container binding of EventTransport or ConsentProofTransport in your app does the same.

Return a ThreeOhEight\Fulmo\Transport\TransportResult:

Factory Use when
TransportResult::delivered() The event was taken (counts as status 200).
TransportResult::response(int $status, string $retryAfter = '', string $error = '') The receiver answered with this status.
TransportResult::unreachable(string $error = '') The receiver could not be reached.
TransportResult::skipped(string $reason) Nothing was attempted. Reasons: SKIPPED_NOT_CONFIGURED, SKIPPED_INSECURE, SKIPPED_CIRCUIT_OPEN.

Rules for implementations:

  • Do not throw on an unreachable or refusing receiver; return a result. error is a short reason and must never contain the payload.
  • The delivery id is identical on every retry of the same item. Store at most once per id.
  • An in-process transport must not let exceptions carry the event out. A thrown exception can reach the exception handler, a failed job record or an error tracker with the event, including ip and ua at tier 0 when consent.cookieless_visitor_hash is on, attached. Catch everything and return a result.
  • Pair an in-process event transport with dispatch.mode = sync so the event is never queued.

Wire contract

The default transport posts to {url}/webhook/analytics (events) and {url}/webhook/consent (proofs) with these headers:

Header Value
X-Consent-Source transport.source_id
X-Webhook-Id The delivery id. Identical on every retry of the same item.
X-Webhook-Timestamp Unix seconds at send time (Fulmo accepts a 300 second window).
X-Webhook-Signature sha256= followed by hex(HMAC-SHA256(secret, "{timestamp}.{body}")) over the exact bytes posted

The body is {"events":[event]} with exactly one event per delivery. Redirects are never followed.

Delivery of events (ForwardEvent):

  • 4 tries, with waits of 30, 120 and 600 seconds between them.
  • A 5xx, an unreachable Fulmo or an open circuit breaker is retried; after the fourth attempt the event is dropped and logged.
  • A 429 is retried after at least 120 seconds, longer when Retry-After (seconds or an HTTP date) asks for it, at most 3600 seconds.
  • 400, 401, 403, 413, 422 and 3xx answers are final and only logged. 401 and 403 are logged as an error at most once a day, because they mean the source configuration is wrong.
  • Consent proofs sent with after_response get one attempt. Outbox proofs follow the backoff described under Scheduler.

Circuit breaker: a connection failure sets a cache flag for transport.circuit_breaker_seconds. While it is set nothing is sent, so an unreachable Fulmo does not cost one timeout per item. Recordings have their own breaker per kind (hm, fa, sr), so a failing recording does not pause events. Timeouts are transport.timeout (3 s), transport.recording_timeout (15 s, recordings only) and transport.connect_timeout (2 s). In sync dispatch mode a failed delivery is logged (at most once a minute) instead of released.

Performance monitoring

The package can forward page speed measurements (Core Web Vitals) as type: "perf" events. It is off by default.

FULMO_PERFORMANCE_ENABLED=true

Turn it on after you have updated your privacy statement. The switch is performance.enabled (FULMO_PERFORMANCE_ENABLED, default false). Both config routes, GET {prefix}/config (read by track.js) and GET {consent_prefix}/config (read by the banner), are answered by the same controller and report collect.perf: true only while the switch is on and the visitor's consent grants the Analytics category, false otherwise.

Performance module. Fulmo's measuring code is a separate file, public/fulmo-perf.min.js (vendored unmodified, recorded in public/VERSION). The package serves it on GET {prefix}/perf.js (route name fulmo.perf, no cookie). Requested with ?v= equal to the module's content version, it answers Cache-Control: public, max-age=31536000, immutable; without the query or with another version, public, max-age=300, so a CDN never keeps this content under a URL that names other content. The route answers 404 while the switch or the tracker (enabled) is off. While the switch is on, <x-fulmo::scripts /> sets data-perf="/{prefix}/perf.js?v={version}" on the track.js tag its loader injects; with the switch off the output is unchanged and track.js never requests the module. track.js loads it only at consent tier 1 or higher, with collect.perf true, for a visitor that is not a bot, and only when the Analytics grant was already stored before the page started loading (FulmoConsent.grantedAtLoad()): on the page where the visitor gives consent nothing is measured; measuring starts on the next page view. The module is same-origin and gets the loader's nonce, so a CSP needs no extra source for it. It writes no cookie, localStorage or sessionStorage.

Gate. A performance event is forwarded only when the switch is on and the visitor's consent tier is 1 or higher (Analytics category granted). The gate runs before anything else: at tier 0, or with the switch off, the beacon is answered with 204 and nothing is forwarded. It is not turned into a load event.

Never forwarded. A performance event carries no sid, no tid, no ip, no ua and no visitor hash, also with consent.cookieless_visitor_hash on. Besides the fields below it holds endpoint, s, tier, type, ts, path, received_at, country, region, consent_flags and, when the visitor sent a Global Privacy Control signal, gpc.

Performance wire contract

Every field is checked on its own. An invalid, out of range or unknown value is dropped, never clamped, because a clamped value would distort percentiles. A part (a ttfb_*, lcp_* timing or inp_* timing field) is also dropped when its metric is absent or when it is larger than its metric. An event without any of ttfb, fcp, lcp, inp or cls is dropped as a whole. Times are integer milliseconds from 0 to 60000.

Field Type Range or allowed values
v integer 1
tpl string ^[a-z0-9][a-z0-9_./-]{0,63}$
browser, os, device string ^[A-Za-z0-9][A-Za-z0-9 ._-]{0,31}$
nav string navigate, reload, back_forward, bfcache, prerender, restore
pvt string first, next, return
proto string ^[a-z0-9][a-z0-9./-]{0,15}$
st integer 100 to 599
tsz integer 0 to 2147483647 (bytes)
ect string slow-2g, 2g, 3g, 4g
mem number 0.25, 0.5, 1, 2, 4, 8
vw string xs, sm, md, lg, xl
ttfb, fcp, lcp, inp integer 0 to 60000 ms
cls number 0 to 10, rounded to 4 decimals
ttfb_wait, ttfb_cache, ttfb_dns, ttfb_conn, ttfb_req integer 0 to 60000 ms, at most ttfb
lcp_ttfb, lcp_delay, lcp_load, lcp_render integer 0 to 60000 ms, at most lcp
inp_input, inp_proc, inp_pres integer 0 to 60000 ms, at most inp
lcp_el, inp_el, cls_el string Selector built by the tracker: SELECTOR_PATTERN, at most 120 characters, and no #id or .class token matching SELECTOR_DENY_TOKEN
lcp_type string image, text, video, bg
lcp_ft string LCP_FILE_TYPES: avif, webp, jpg, jpeg, png, gif, svg, jxl, bmp, ico, mp4, webm, ogv, mov
lcp_lazy boolean true, false
lcp_prio string high, low, auto
lcp_host string A lower case hostname, at most 253 characters
inp_evt string INP_EVENT_TYPES: pointerdown, pointerup, pointercancel, mousedown, mouseup, click, dblclick, auxclick, contextmenu, touchstart, touchend, touchcancel, keydown, keyup, keypress, beforeinput, input, compositionstart, compositionupdate, compositionend
loaf list 1 to 3 script entries; more than 3 drops the field. An entry with an invalid sub-field is dropped, except for path, which is dropped on its own.

SELECTOR_PATTERN is ^[a-z][a-z0-9-]{0,31}(?:#[a-z][a-z-]{1,30})?(?:\.[a-z][a-z-]{1,30}){0,3}(?: > [a-z][a-z0-9-]{0,31}(?:#[a-z][a-z-]{1,30})?(?:\.[a-z][a-z-]{1,30}){0,3}){0,4}$: the element and at most four ancestors joined by >, each a tag with an optional id and up to three classes made of lower case letters and dashes. Text content, attribute values and URLs are never part of a selector. SELECTOR_DENY_TOKEN is (^|-)(author|user|byuser|member|profile|customer|account|name)(-|$), tested against each #id and .class token: a token that may name a person (comment-author-jansen, user-pietje) drops the whole selector. The deny word must be a whole dash-separated part, so username-field is kept.

Each loaf entry:

Key Type Range or allowed values
dur integer 0 to 60000 ms, required
host string A lower case hostname, at most 253 characters
path string Kept only when fp is true, the path differs from the page path and matches LOAF_PATH_PATTERN (^/(?:[A-Za-z0-9._-]{1,40}/){0,6}[A-Za-z0-9._-]{1,64}\.m?js$), at most 160 characters; otherwise only path is dropped and the entry stays. Digit-only segments (a build hash or version) are accepted.
fn string ^[A-Za-z0-9_$.<>]{1,64}$
inv string LOAF_INVOKER_TYPES: user-callback, event-listener, resolve-promise, reject-promise, classic-script, module-script
fp boolean true when the script is first party

Envelope keys type, ts, path and s follow the other event types and are not part of this table.

Recordings

The package can forward three kinds of recordings to Fulmo. All are off by default.

Feature Beacon Config block Env switch What it collects
Heatmaps POST {prefix}/hm heatmap FULMO_HEATMAP_ENABLED Clicks, mouse moves and scroll depth.
Form analytics POST {prefix}/fa forms FULMO_FORMS_ENABLED Per field interaction events of forms.
Session replay POST {prefix}/sr replay FULMO_REPLAY_ENABLED rrweb DOM snapshots and events, chunk by chunk: a replayable record of the visit, not a video.
FULMO_HEATMAP_ENABLED=true
FULMO_FORMS_ENABLED=true
FULMO_REPLAY_ENABLED=true

Each switch needs the tracker on (enabled). Turn one on only after your privacy statement is updated, and only when your Fulmo is on a version that accepts recordings from a consent source; an older Fulmo refuses them.

Consent. Recordings have their own consent category, rec. Add it to consent.categories (for example ['a', 'om', 'dl', 'rec']); a site that does not list it never offers it, and no recording is forwarded. A listed rec is offered only while at least one recording is switched on (and the tracker with it), so nobody is asked to consent to recordings that cannot happen. The visitor must choose it explicitly. It requires Analytics (a), is never on by default under any strategy, is off when the visitor sends Global Privacy Control, and is only granted where the policy permits consent tier 2. Returning visitors are asked again when rec is offered and missing from their stored choice. The grant is checked twice: the beacon route here, and again by Fulmo, which ignores any tier the package sends and drops the recording when the grant does not hold.

Scripts. For each enabled feature the inline loader of <x-fulmo::scripts /> carries the script's versioned URL and injects it once, only after the visitor granted Analytics and Recordings (a and rec); the page itself has no tag with that src, so nothing fetches it before consent. The scripts, including rrweb for replay, are vendored in the package (public/fulmo-heatmap.min.js, fulmo-forms.min.js, fulmo-replay.min.js) and served by your own app on GET {prefix}/heatmap.js, {prefix}/forms.js and {prefix}/replay.js. A visitor's browser makes no request to a third party; the licences of the bundled code are in public/THIRD_PARTY_LICENSES.md. A revoked choice stops the scripts and discards what they had buffered.

End of a replay. The replay script flags its last chunk of a page with is_end. That chunk is often empty, because the regular flush already sent what was buffered; an empty events list is forwarded only for a replay chunk with is_end true, so Fulmo can mark the session completed. Any other empty beacon (a replay chunk that is not the end, a heatmap or form analytics body) is dropped.

What replay records. The text of the page is recorded, so anything a visitor can read on a page may end up in a replay. Form field values and contenteditable content are masked in replays, and heatmap clicks carry no text for form fields, contenteditable content or masked and blocked elements. Only form field values are masked: text the site itself shows back on the page (search terms in a results heading, a greeting with the visitor's name, validation messages) is ordinary page text, is recorded in replays and may appear as heatmap click text, so mark such elements with data-sr-mask. Editors that use designMode (often in an iframe) without a contenteditable attribute are not matched automatically; wrap them in data-sr-mask or data-sr-block. Opt out per element with the sr-mask class (text is masked), the sr-block class (the element is not recorded at all) or the data-sr-* attributes of the replay script. Keep pages with sensitive content out of scope that way.

Your duty. Describe heatmaps, form analytics and session replay, including that page text is recorded, in your privacy statement before you switch them on.

Limits. Each beacon has its own body limit and its own rate limits, apart from the page views.

Key Default Meaning
heatmap.max_body_bytes, forms.max_body_bytes 65536 A declared Content-Length above it answers 413.
replay.max_body_bytes 1000000 Same, for a replay chunk.
limits.heatmap_per_ip, limits.forms_per_ip 60 Requests per minute per address.
limits.heatmap_global, limits.forms_global 1200 Requests per minute from all visitors together.
limits.replay_per_ip 240 Requests per minute per address.
limits.replay_global 900 Requests per minute from all visitors together.

A published config keeps the limits it was published with; change them there. A replay chunk above Fulmo's body cap answers 413 (after the consent check), not 204. Replay events may be packed strings; heatmap and form analytics events must be objects.

The limits are also enforced by routes.global_body_guard before the body is parsed (see routes).

Queue size. Recordings are delivered by ThreeOhEight\Fulmo\Jobs\ForwardRecording through a RecordingTransport (Fulmo::transportUsing() takes it as an optional third closure), under the same dispatch settings as events. The job holds the envelope gzipped and is encrypted, so a replay chunk can still be large in the queue store. Amazon SQS caps a message at 256 KiB: with SQS use dispatch.mode after_response, which runs the job in the same process without queueing it. There is no separate config key for the job size.

Privacy and security notes

  • By default no event carries the visitor's IP address or user agent, at any tier, so a tier 0 event (no consent) holds nothing that identifies the visitor and Fulmo derives no visitor hash. Only with consent.cookieless_visitor_hash on do ip and ua leave the forwarder, at consent tier 0 only, in transit, for Fulmo to truncate, hash into a daily rotating visitor id and discard. That is personal data sent without consent: enable it only with a legal basis and a privacy statement that says so. They are never sent at tier 1 or higher, and the package never logs them. Log context carries only the status and the delivery id.
  • Consent records contain no IP address and no user agent.
  • Laravel Telescope records HTTP client requests and queued jobs, which would capture ip and ua when consent.cookieless_visitor_hash is on, and the rest of each event in any case. Exclude your Fulmo host from the HTTP client watcher and ThreeOhEight\Fulmo\Jobs\ForwardEvent and ForwardConsentProof from the job watcher (for example with a Telescope::filter callback). Apply the same idea to any other request recorder.
  • Trusted proxies. Configure trusted proxies with explicit CIDRs, never '*'. The geo headers in consent.trusted_geo_headers are honoured only when the request comes from a trusted proxy. An untrusted request has unknown geo and fails closed to the strictest consent regime. Trusting every proxy would let any client choose its own regime.
  • Rate limits. The beacon route has a per-address and a global bucket (limits.tracker_per_ip, limits.tracker_global). The consent-log route has limits.consent_log_per_ip and a global limits.consent_log. The global buckets cap total load when many addresses act together. The consent config routes are limited to 120 requests per minute per address.
  • The enabled switch turns the tracker off: the beacon route answers 404 and no loader renders, so track.js is never injected. The consent banner and its routes stay on unless consent.enabled is false.
  • Anyone can post a consent proof for a site id they can see. That only weakens the proof trail; a forged row cannot grant consent, because the browser decides from its own fulmo_consent cookie.

Testing

composer test
composer test:types
composer lint:test

test runs Pest, test:types runs Larastan, lint:test checks code style with Pint.

Security

See SECURITY.md for the responsible disclosure process.

License

MIT, see LICENSE.