Vibiz

Install

The npm package, in the framework you are already using.

npm i @vibiz/analytics

Your org id looks like org_…, and it is the only value you need. Copy it from Intelligence rather than looking it up: a workspace also has a uuid of its own, and passing that instead is accepted and then matches nothing, which reads back as a site with no visitors. There is no key to generate: anything that ships in the page source of every tracked site is an identifier rather than a secret, exactly like a Meta pixel id, so a separate one would have been a second public value doing the same job.

API name

Use init({ orgId }). Older 0.2.0 builds called the same value workspaceId; current releases (0.4.1+) use orgId only.

What binds traffic to your workspace is the list of domains you allow, not the id. Until your domain is on that list nothing sent from a browser is kept, so add it as soon as you have pasted the tag. You do not have to guess which to add: load a page and Intelligence names the domain it is hearing from, with a button to allow it.

Create a client component

init needs a real window, so it runs in an effect rather than during render.

components/analytics.tsx
'use client';
import { useEffect } from 'react';
import { init } from '@vibiz/analytics';

export function Analytics() {
  useEffect(() => {
    init({ orgId: process.env.NEXT_PUBLIC_VIBIZ_ID as string });
  }, []);
  return null;
}

Mount it once in the root layout

app/layout.tsx
import { Analytics } from '@/components/analytics';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Analytics />
      </body>
    </html>
  );
}
.env.local
NEXT_PUBLIC_VIBIZ_ID=org_xxx

Track a conversion

Route changes need no handling: they are captured for you.

'use client';
import { track } from '@vibiz/analytics';

// after the server confirms the payment, not on submit
track('purchase', { value: 49.9, currency: 'EUR', order_id: order.id });

Options

Property

Type

A pasted <script> tag takes the same options as attributes: data-vibiz-id, data-vibiz-endpoint, data-vibiz-autocapture="false", data-vibiz-forms="false", data-vibiz-debug="true", data-vibiz-exclude-paths (comma separated), data-vibiz-redact (regular expressions, space separated) and data-vibiz-capture-text="false".

<script async src="https://www.vibiz.ai/sdk/v1/v.js" data-vibiz-id="org_xxx" data-vibiz-forms="false"></script>

Keep private pages and values out

Every event carries the page URL and the referrer, and autocapture records the text of what was clicked. On a page with a wallet address, a reset token or a name in the path, that is the value you meant to keep. Nothing is held back by default, so an existing install keeps sending exactly what it sent.

init({
  orgId: 'org_xxx',
  excludePaths: ['/account', '/wallet/*'],
  redactPatterns: [/0x[0-9a-fA-F]{40}/, /([?&]token=)[^&#]+/],
  captureText: false,
  beforeSend: (event) => (event.name === 'click' && event.url?.includes('/admin') ? null : event),
});

An excluded page sends nothing at all, and a referrer pointing at one of your excluded pages is cut down to your origin. Patterns and redactUrl apply to the page URL, the referrer and a clicked link's address. beforeSend sees the event last, already redacted, as { name, url, referrer, properties, element }.

A pasted tag cannot pass a function as an attribute. Set them on window.vibizConfig before the tag instead; its keys win over the attributes.

<script>
  window.vibizConfig = {
    redactUrl: (url) => url.replace(/\/orders\/[^/?#]+/, '/orders/:id'),
    beforeSend: (event) => event,
  };
</script>
<script async src="https://www.vibiz.ai/sdk/v1/v.js" data-vibiz-id="org_xxx" data-vibiz-exclude-paths="/account,/wallet/*"></script>

One implementation, two entry points

The server entry point captures nothing of its own: it sends events you already know about, over the same wire format the browser uses. Two capture implementations would drift, and the drift would show up as two behaviours under one name.

On this page