The track Function

Last updated: March 31, 2026

The Noibu JavaScript SDK includes a track() function for sending key ecommerce events (e.g. add to cart, checkout, purchase) to Noibu. Event data is captured in session replays, giving your team additional context into shopper behaviour during issue investigation.

For Shopify and BigCommerce deployments, ecommerce event collection is enabled automatically. For all other platforms, use the track() function to implement it manually.


Basic structure

window.NOIBUJS.track(eventType, eventData);

Because the Noibu JS SDK is attached to the global window as window.NOIBUJS, make sure it’s available before calling track() (or wait for the noibuSDKReady event).


Parameters

eventType: string (required)

One of the following supported event types:

  • product_added_to_cart — logged when a customer adds a product to their cart

  • product_removed_from_cart — logged when a customer removes a product from their cart

  • checkout_started — logged when a customer begins the checkout process

  • payment_info_submitted — logged when a customer submits their payment information

  • checkout_completed — logged when a customer completes a purchase

  • search_submitted — logged when a customer performs a search on the storefront

  • collection_viewed — logged when a customer visits a product collection index page

  • product_viewed — logged when a customer visits a product details page

  • cart_viewed — logged when a customer visits the cart page

These event names match Shopify’s standard Web Pixels event names. (Shopify)

eventData: object (required)

An object whose shape matches the payload of the corresponding Shopify Web Pixels “standard event” for the given eventType. All fields are optional (you can send partial payloads). (Shopify)


Return value

track() returns:

{ success: boolean, errors: string[] }
  • success: true when the event is accepted for tracking; otherwise false

  • errors: a list of validation errors (empty when success is true)


Examples

Wait for SDK readiness (recommended)

async function trackCheckoutStarted() {
  if (!window.NOIBUJS) {
    await new Promise((resolve) => window.addEventListener("noibuSDKReady", resolve));
  }

  const result = window.NOIBUJS.track("checkout_started", {
    // Shopify-standard payload shape; all fields optional
    checkout: {
      token: "example-checkout-token",
      totalPrice: { amount: 49.99, currencyCode: "USD" },
    },
  });

  if (!result.success) console.warn("Noibu track failed:", result.errors);
}