Skip to main content

Module script

Module script 

Source
Expand description

The optional first-party script ([traffic] script = true, 18.31.0): rws serves /_rws/t.js itself, and the script reports to /_rws/t on the same origin what the server can’t see — time on page, scroll depth, screen size, single-page-app route changes and custom events (rws.track("signup", {plan: "pro"})). Nothing is stored in the browser; the visitor is the same daily hash as for every request.

TrafficScriptLayer answers only those two paths and passes every other request straight through (Middleware::is_passthrough), so it costs nothing elsewhere and doesn’t take proxy routes off the async forwarder.

Structs§

TrafficScriptLayer
Answers /_rws/t.js and /_rws/t when [traffic] script is on (it reads the setting when built); otherwise, and for every other path, passes the request on.

Constants§

BEACON_PATH
Where the script reports.
MAX_BEACON
The largest report accepted.
SCRIPT
The script. No dependencies, no storage, ~1.6 KB (0.8 KB compressed). The first page view is already counted by the server, so it reports only what happens after: leaving a page (time, scroll, width), route changes, events.
SCRIPT_PATH
The script’s URL path.