Send feedback

JavaScript SDK (browser)

Everything exported by @optiqstudio/track. The script tag exposes the same calls as optiq("track", …), optiq("identify", …) and optiq("consent", …).

init#

TypeScript
init(options: InitOptions): Tracker | null

Starts tracking on the page, once; later calls return the same tracker. In a server render, or without a valid key, it returns null.

NameTypeDescription
keyrequiredstringThe source's publishable key (pk_…).
autobooleanPage views, form starts, leads from marked forms and contacts by themselves. Default true.
endpointstringWhere events go. Default: the Optiq Studio Enterprise collector.
consentConsentThe visitor's choice, if your site already knows it.

track#

TypeScript
track(name: string, props?: Properties): void

Something a visitor did. Calls made before init wait for it. Events leave in small batches within half a second, and at once when the page is hidden.

NameTypeDescription
valuenumberA sale's or deposit's amount.
currencystringThree letters.
emailstringHashed in the browser; not sent as written.
phonestring | numberDigits only, hashed in the browser.
[property]string | number | booleanUp to 30 of your own.

identify#

TypeScript
identify(person: { email?: string; phone?: string | number }): void

Who the visitor is from now on, hashed in the browser. Their later events carry the hash, so a sale your server sends can be joined to this visit.

TypeScript
consent(state: "granted" | "denied" | "unknown"): void

The visitor’s choice, remembered on the device. Denied removes the visitor id, the person, the ad click ids and the stored visit; pages are still counted.

page and flush#

TypeScript
page(): void    // a page view by hand (auto mode sends them by itself)
flush(): void   // send what waits now

suggest#

TypeScript
suggest(o?: { product?: string; exclude?: string[]; limit?: number }): Promise<{ suggestions: Suggestion[]; recentlyViewed: Suggestion[] }>

Products to show this browser’s shopper, and why. Never throws: on any failure both lists are empty. See Personalise.

Helpers#

ExportTypeDescription
TrackerclassOne tracker on one page, with the same methods. init() makes and shares one.
hashPerson(p) => Promise<string | null>The SHA-256 the SDK sends for an email or phone.
contactChannel(href) => channel | nullWhich contact a link begins: call, email, whatsapp, or null for a share link.
COLLECTORstringThe collector's address.

Last updated 2026-11-04 UTC. The SDK is open source under the MIT licence. Tell us what is missing.