JavaScript SDK
The SDK records page views and events in the browser and sends them to your tracking domain. It reads consent from your banner, captures ad click IDs and UTM parameters from the landing URL, and batches events so it does not slow pages down.
Shopify and WooCommerce stores do not need it: the app and the plugin install it for you.
Script tag
Copy the snippet from the store's setup steps in the dashboard and paste it into the <head> of every page:
<script async src="https://t.yourstore.com/c.js"></script>
Before your tracking domain is live, the snippet points at the shared endpoint and carries your store key:
<script async src="https://edge.waiso.app/c.js?k=YOUR_STORE_KEY"></script>
Calls made before the script loads are queued and replayed:
<script>
window.waiso = window.waiso || [];
waiso.push(["track", "sign_up", { plan: "newsletter" }]);
</script>
The script tag accepts these attributes:
| Attribute | Effect |
|---|---|
data-autocapture="false" | Turn off automatic page views and form capture |
data-page-views="false" | Keep form capture but send page views yourself |
data-debug="true" | Log each event to the browser console |
npm package
npm install @waiso/sdk
import { init } from "@waiso/sdk";
const waiso = await init({ endpoint: "https://t.yourstore.com" });
waiso.track("add_to_cart", {}, { value: 49, currency: "EUR", items: [{ id: "sku-1", quantity: 1, price: 49 }] });
Methods
| Method | Use |
|---|---|
page(properties?) | Record a page view. Sent automatically, including single-page app navigations. |
track(event, properties?, options?) | Record an event. options takes value, currency, items, order_id, checkout_token and user. |
identify(user, properties?) | Link the visitor to email, phone, customer_id and address fields. Values are hashed at the edge. |
consent({ analytics, marketing, sale_of_data? }) | Set consent yourself if you do not use a supported banner. |
on(callback) | Listen to every event the SDK sends, for example to debug. |
Standard events
Use these names so Waiso maps them to each ad platform: page_view, view_item, add_to_cart, begin_checkout, add_payment_info, lead, sign_up, subscribe. Any other name is a custom event that you can map per platform.
purchase and refund are only accepted from the server, so a browser cannot fake an order. Send them through the Server API.
What autocapture does
- Page views, including history-based navigations in single-page apps.
- Email and phone from submitted forms, sent as a
leadevent and hashed at the edge. - Optionally, scroll depth (50% and 90%), time on page and outbound link clicks, when Capture engagement is on in the consent settings.
It never records keystrokes, form fields other than email and phone, or session replays.