This acts as a thin wrapper over the Zaius Web SDK to make it easier to work with in Web App/TypeScript environments.
⚠️ WARNING: This is ONLY a browser SDK.
To interface with Zaius from a NodeJS environment, use our Node SDK
Please see our documentation for more information about using the Web SDK.
To install using npm:
npm i @zaiusinc/web-sdk
To install using yarn:
yarn add @zaiusinc/web-sdk
First you need to initialize the SDK via,
Zaius.initialize({trackerId: <YOUR_TRACKER_ID>})
This will pull our Browser SDK into your page via an async <script> tag, and we'll queue calls to the SDK prior to the script tag being loaded, so don't worry about whether or not the SDK is available yet.
To notify Zaius about a user performing an action of some kind, simply call
Zaius.event("<EVENT_TYPE>", {OTHER: "FIELDS"})
NOTE: If you're used to using the JS tag code from the integrations page in our web app, that fires a pageview event, this SDK will not trigger a page view when the sdk is initialzied, and if you wish this to happen, you'll need to add a manual call to
Zaius.event('pageview')
after you initialize the SDK.