Connect Oraami to JavaScript and TypeScript

Install the browser tracker in JavaScript and TypeScript, connect your analytics consent choice and verify the first saved visit.

Updated Oraami Inc

Install the web library

Register the website in Oraami and copy its public site key and collector origin from Settings → Installation. Use one installation per document. Allow the collector in your site’s script-src and connect-src policies.

npm install https://app.oraami.com/downloads/oraami-web-1.0.0.tgz

Add the tracker to your application

Call connectTracker once from the browser entry point. Keep the cleanup function for application teardown.

import { connectTracker } from '@oraami/web';
import { options, consent } from './oraami-config.js';
const disconnect = connectTracker(options, consent);
// On teardown, call disconnect().

Check the first visit

  1. Open the registered origin. Decline analytics and check that no event or replay uploads start. The tracker script and site configuration may load.
  2. Grant analytics consent, navigate and open Capture health in Oraami. Check that a new batch was saved for this website.
  3. Withdraw consent, interact again and verify that new uploads stop. Reload to check the remembered choice.

Related guides