LANDSCAPE

Getting Started

Install Landscape, call init, and start capturing events.

Install

pnpm add @hyperreal/landscape-core

Capture events

import { init } from "@hyperreal/landscape-core";

init({ endpoint: "/api/events" });

endpoint is your ingest route. Landscape POSTs JSON { events, context? } to it.

What starts by default

In the browser, init():

  • starts autocapture (clicks, forms, outbound links, downloads, scroll, rage clicks)
  • emits one $pageview
  • attaches metadata such as $path, $browser, and $country
  • flushes every 10 events or 5000 ms, and on pagehide / visibilitychange to hidden

Consent defaults to { analytics: true } until something is stored. See setConsent.

Record a custom event

import { init, track } from "@hyperreal/landscape-core";

init({ endpoint: "/api/events" });
track("signed_up", { plan: "pro" });

Autocapture does not require track(). Use it for custom or business events. See track.

Receive batches

Handle POST /api/events (or your endpoint) and return 2xx. Merge context into each event’s properties. See Ingesting Events. Runnable reference: examples/server/src/index.ts.

Next

Task Page
Toggle autocapture categories Autocapture
Store and query events Ingesting Events
React / Next.js React
Validate custom events Typed events
Web Vitals and errors Plugins
init options init