Skip to content

Routes & middleware

MethodURINameMiddlewareRegistered when
POSTvisits/collectvisits.collectcollect.middleware + throttle:{rate_limit.endpoint}always
GET{whoami.path} (visits/whoami)visits.whoamiwhoami.middleware + throttle:{rate_limit.whoami}whoami.enabled
GET{dashboard.path}visits.indexdashboard.middlewaredashboard.enabled
GET{dashboard.path}/campaignsvisits.campaignsdashboard.middlewaredashboard.enabled
GET{dashboard.path}/sessionsvisits.sessionsdashboard.middlewaredashboard.enabled
GET{dashboard.path}/sessions/{id}visits.showdashboard.middlewaredashboard.enabled
GET{dashboard.path}/visitorsvisits.visitorsdashboard.middlewaredashboard.enabled
GET{dashboard.path}/visitors/{id}visits.visitordashboard.middlewaredashboard.enabled
GET{dashboard.path}/mevisits.medashboard.middlewaredashboard.enabled
GET{dashboard.path}/livevisits.livedashboard.middlewaredashboard.enabled and live.enabled
GET{dashboard.path}/live/feedvisits.live.feeddashboard.middlewaredashboard.enabled and live.enabled
GET{dashboard.path}/live/streamvisits.live.streamdashboard.middlewaredashboard.enabled and live.enabled

With visits.enabled = false only POST /visits/collect is registered (it answers {"visitor_id": null}); the dashboard and whoami routes are not (since 0.13.6). The collect path is fixed; only the whoami and dashboard paths are configurable.

Request body (JSON or form):

FieldRules
typenullable, page_view or action; page_view when omitted
namenullable, string, max 255, required if type is action
urlnullable, string, max 2048
referrernullable, string, max 2048
metanullable, array
visitor_idoptional, alternative to the X-Visitor-Id header

Headers: X-Visitor-Id (visitor id), X-CSRF-TOKEN (under the web group), Accept: application/json (JSON validation errors).

StatusBodyWhen
200{"visitor_id": "<uuid>"}Accepted and queued
200{"visitor_id": null}visits.enabled is false
403{"visitor_id": null}collect.allowed_origins is set and the origin is not listed (checked before validation)
419CSRF token mismatch under the web group
422validation errorsInvalid fields
429Throttled

The response also queues the visitor cookie (written only under the web group). Details: Client integration.

Query: ip (optional, valid IPv4/IPv6; anything else is ignored). Returns the snapshot described in Whoami, encoded with JSON_FORCE_OBJECT so empty groups are {}.

RouteParameters
visits.index, visits.campaignsfrom, to (dates), tenant, breakdown_metric (sessions or conversions)
visits.sessionsfrom, to, visitor_id, country_code, device_type, utm_source, ip, with_bots, sort (started_at, page_views_count, duration_seconds, country_code, device_type, utm_source, referrer_host, ip), direction
visits.visitorsfrom, to, token (partial match), country_code, device_type, utm_source, returning_only, with_bots, sort (first_seen_at, last_seen_at, sessions_count, country_code, device_type, utm_source), direction
visits.showsort (created_at, type, name), direction (default asc)
visits.meip
visits.live.feed, visits.live.streamsince (ISO 8601; default 30 seconds ago)

visits.live.feed returns {"events": [...], "since": "<ISO 8601>"}; each event has session_id, lat, lng, city, country_code, type, name, created_at. visits.live.stream sends the same object as Server-Sent Events data: frames.

ClassAliasRegistered
Fomvasss\Visits\Http\Middleware\TrackVisittrack-visitsAlias always; appended to the web group when visits.enabled and auto_track are true

Both registrations happen in the application’s booted() callback, after all providers have booted. See Page views.