Skip to main content
Use the client-side API when the normal pixel form detection is not enough and you need to trigger Octanist from your own browser JavaScript. Do not use this page for server-side API calls. API keys must stay on your server. For backend form submissions, use Server-side form capture.

Before you start

Install the Octanist pixel on the page first:
If you send the same form manually with window.OCT.submitLeadForm, prevent automatic browser capture for that form with data-octa-ignore.
This keeps the pixel active for page views, sessions, consent, and octa_sid, while preventing the same form from being captured twice.

Send a form submission

Use window.OCT.submitLeadForm(fields, options) after your form has successfully submitted.
The method returns true when Octanist accepted the payload for sending. It returns false when the payload is empty or invalid. Supported options: Octanist ignores sensitive fields such as passwords, captcha tokens, card fields, CSRF tokens, and octa_sid. Field values are trimmed and long values are shortened.

AJAX example

For AJAX forms, send the form to your own endpoint first. Call Octanist only after the website knows the form was accepted.

Read the session ID

Use window.OCT.getSessionId() when you need the browser session ID.
This is the same value the pixel injects into forms as octa_sid. Use window.OCT.setConsent() when your consent banner has its own callback and Octanist cannot detect it automatically.
To revoke consent:
When consent changes from denied to granted, Octanist upgrades the session and stores the consent state. When consent is revoked, Octanist records the downgrade and removes the visitor cookie. If your consent code can run before the pixel has finished loading, use one of these options. Set a global value before the pixel loads:
Or dispatch an event when your consent banner changes:

Other OCT methods

Example debug snapshot:

Debugging

Use window.OCT.debug() for a quick browser console snapshot. For a fuller support report, use the Octanist Debugger.