Arenza is now part of the OpenAI Partner Network 🎉
Chapters

Website SDK

1. Prerequisites

Website: installation ID

Open Arenza Portal → AI Integrations, select your brand, and copy Website install ID. It starts with arz_pub_. Replace YOUR_INSTALL_ID below with that value.

This public ID identifies your brand; it is not a secret API key. HTML/JavaScript use it to obtain a short-lived browser session; the SDK sends that session token with track(). It binds requests to a visitor and origin, but does not prove website ownership or business success. Origin restrictions are optional; see browser authentication.

Before you start

  • Use an HTTPS website. If the integration has a reporting-origin allowlist, your origin must match it. Without that optional restriction, other valid HTTPS origins can also obtain sessions using the public install ID.
  • Choose the business condition you want to report. Do not report both a button click and its successful outcome unless you intend two events.

2. Examples

HTML

Initialize

Replace YOUR_INSTALL_ID, then add this block to your page through your site's analytics-consent integration. The first tag loads and initializes the SDK; the second lets your event code wait until it is ready.

HTML

<script src="https://arenza.ai/sdk/v1.js"
        data-arenza-install-id="YOUR_INSTALL_ID"></script>
<script>
  window.arenzaReady = window.arenzaEvents.init()
    .then(() => window.arenzaEvents);
  window.arenzaReady.catch(() => {
    console.warn('Arenza initialization failed.');
  });
</script>

Send an event

For example, to report a completed booking: find the code that handles a successful response from your booking API, and add the following code there. Do not add it to the error handler.

JavaScript (browser)

// Your code has confirmed the booking (or another event you chose).
void window.arenzaReady
  .then((client) => client.track())
  .catch(() => console.warn('Arenza event could not be sent.'));
// Continue your normal workflow.

JavaScript

Initialize

Load https://arenza.ai/sdk/v1.js using a script tag without data-arenza-install-id, then run this once after it loads and after analytics consent.

JavaScript (browser)

// ArenzaBilling is provided by the loaded SDK.
window.arenzaEvents = window.ArenzaBilling.create({
  endpoint: 'https://api.arenza.ai/api/v1/events/collect/YOUR_INSTALL_ID',
  consent: true,
});
window.arenzaReady = (async () => {
  await window.arenzaEvents.init();
  return window.arenzaEvents;
})();
window.arenzaReady.catch(() => console.warn('Arenza initialization failed.'));

Initialization records a page visit and prepares sending credentials. It does not send your business event. The SDK supplies the visitor ID, request IDs and authentication.

Send an event

For example, to report a completed booking: find the code that handles a successful response from your booking API, and add the following code there. Do not add it to the error handler.

JavaScript (browser)

// Your code has confirmed the booking (or another event you chose).
void window.arenzaReady
  .then((client) => client.track())
  .catch(() => console.warn('Arenza event could not be sent.'));
// Continue your normal workflow.

3. Parameters and responses

When to send

You decide when to execute that snippet:

ExampleWhere to put the report
Booking confirmedAfter your booking API returns a successful confirmation.
Enquiry acceptedAfter your enquiry API accepts the submission, not on validation failure.
Trial activatedAfter your application confirms activation, not merely when its button is clicked.

Current limit: browser track() does not support named event types. These are possible trigger locations, not distinct event names in Arenza reports. track('booking_confirmed') is unsupported. Choose one reporting path per occurrence: SDK, raw HTTP or server webhook.

Visitor ID handoff

After installing the HTML or JavaScript example, read the visitor ID:

JavaScript (browser)

const visitorId = window.arenzaEvents.getVisitorId();

Add that value as arenza_visitor_id to your existing request to your own backend. Your backend should save it with the relevant business record so an asynchronous worker can use it later. The getter sends no event. Do not also call browser track() for the same server-reported event.

Browser SDK methods

MethodPurpose
ArenzaBilling.create({ endpoint, consent: true })Create the client.
client.init()Prepare/reuse sending credentials.
client.track()Send an event; ensure credentials and retry transient failures.
client.getVisitorId()Read the visitor ID without sending an event.
client.stop()Stop subsequent collection by this client.

Stop collection

When a visitor turns off analytics in your site's privacy settings:

  1. Stop the current client with window.arenzaEvents?.stop().
  2. Delete the site's arenza_visitor_id cookie using the same path (/) and domain used to set it.
  3. Do not load or initialize the SDK again while analytics is disabled. Cancel any waiting initialization or event callbacks in your consent integration as well.

stop() stops that client; it does not delete the cookie or change your site's consent settings. If the visitor later opts in again, create a new client rather than reusing the stopped instance.

API reference