Skip to Content
API ReferenceJavaScript API

JavaScript API Available (v1)

Once the tracking snippet is installed, it exposes a single global function, visz(...), as a command queue (the same pattern as Google Analytics or Segment). You call it with a command name and arguments:

visz("event", "add_to_cart", { sku: "SHOE-42", value_num: 49.9 });

The snippet handles batching, transport, consent, and PII masking for you. This is the interface 95% of integrations need — you almost never call the REST API directly.

How the queue works

The snippet defines visz as soon as it loads, and buffers any calls made before it finishes booting — so it’s safe to call visz(...) immediately, even above the snippet <script> tag.

Consent gate. Nothing is sent before the visitor consents. Calls to visz('event' | 'tag') made before consent are silently dropped (not queued for later). visz('consent', true) is what opens the gate.

Frequency cap. Custom events (event + tag, plus auto-captured events) share a cap of 100 events per session. Beyond that, further events are silently discarded. This is a cost-control guard, not an error.


visz('consent', granted)

Grant or withdraw tracking consent. Nothing is tracked until you call this with true (unless you wire consent through the dashboard’s banner instead).

Parameters

ArgTypeDescription
grantedbooleantrue grants consent and boots tracking; false withdraws it, stops capture, and discards the in-memory buffer.

Example

// In your cookie-banner "Accept" handler: visz("consent", true); // In your "Reject" / withdraw handler: visz("consent", false);

“Do Not Track” always wins: if the browser sends DNT, the snippet stays inert regardless of this call.


visz('event', name, props?)

Record a custom event — a named thing that happened (add_to_cart, signup_completed, video_played).

Parameters

ArgTypeDescription
namestringEvent name (1–128 chars). Empty/invalid names are dropped.
propsobject (optional)Up to 10 properties. value_num is extracted as an unmasked numeric scalar; every other string value is PII-masked client-side and truncated to 200 chars.

Example

visz("event", "add_to_cart", { sku: "SHOE-42", // masked + truncated category: "sneakers", // masked + truncated value_num: 49.9 // kept as a raw number (e.g. for revenue) });

PII defense. Property values are masked in the browser before anything is sent. Still, never pass raw PII (emails, names, card numbers) in props — use value_num for amounts and stable, non-identifying labels for everything else.


visz('tag', name)

Attach a lightweight tag to the current session — a label you can filter and segment by later (vip, beta_tester, returning_buyer).

Parameters

ArgTypeDescription
namestringTag name (1–128 chars). Empty/invalid names are dropped.

Example

visz("tag", "vip");

Under the hood a tag is sent as a custom event carrying a reserved flag, so it counts against the same 100-events-per-session cap.


visz('identify', user)

Associate the current session with a pseudonymous user identity.

Parameters

ArgTypeDescription
userstring | objectA stable identifier. Only a client-side FNV-1a hash of it is computed and attached to subsequent events as metadata.uid. The raw value never leaves the browser.

Example

visz("identify", "user_8f31c2");

Privacy by design. Visz never receives the raw identifier — only the hash. This lets you correlate a user’s sessions without sending PII over the wire. Do not rely on reversing the hash; it is one-way.


visz('shutdown')

Immediately stop all tracking for the current page: detaches every capture listener, stops the recorder/survey/feedback widgets, and flushes pending events. Equivalent to a consent withdrawal at the runtime level.

Example

visz("shutdown");

Last updated:

Last updated on