The track Function
Last updated: April 27, 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, BigCommerce, Magento 2 (Adobe Commerce), and SFCC SFRA 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 cartproduct_removed_from_cart— logged when a customer removes a product from their cartcheckout_started— logged when a customer begins the checkout processpayment_info_submitted— logged when a customer submits their payment informationcheckout_completed— logged when a customer completes a purchasesearch_submitted— logged when a customer performs a search on the storefrontcollection_viewed— logged when a customer visits a product collection index pageproduct_viewed— logged when a customer visits a product details pagecart_viewed— logged when a customer visits the cart page
These event names match Shopify’s standard Web Pixels event names. (Shopify)
eventData: object (required)
Specified per eventType, see docs below.
Return value
track() returns:
{ success: boolean, errors: string[] }
success:truewhen the event is accepted for tracking; otherwisefalseerrors: a list of validation errors (empty whensuccessistrue)
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);
}
Event Types Overview
| What we extract |
|---|---|
| Product variant info |
| Collection title |
| Search query |
| Cart line item + cost |
| Cart line item + cost |
| Cart total + currency |
| Full checkout snapshot |
| Event count only (no payload fields) |
| Delivery options |
| Delivery options |
| Delivery + payment + pricing |
| Full checkout snapshot + order info |
Fields by Event
product_viewed
Purpose: Tracks which products users view
Extracted field | JSON path in |
|---|---|
SKU |
|
Product title |
|
Variant title |
|
Product type |
|
Product vendor |
|
Variant ID |
|
Product ID |
|
(event count) | — |
Minimum required payload:
{
"productVariant": {
"sku": "...",
"id": "...",
"title": "...",
"product": {
"id": "...",
"title": "...",
"type": "...",
"vendor": "..."
}
}
}
collection_viewed
Purpose: Tracks which collections/categories users browse.
Extracted field | JSON path in |
|---|---|
Collection title |
|
(event count) | — |
Minimum required payload:
{
"collection": {
"title": "..."
}
}
search_submitted
Purpose: Tracks site search queries
Extracted field | JSON path in |
|---|---|
Search query |
|
(event count) | — |
Minimum required payload:
{
"searchResult": {
"query": "..."
}
}
product_added_to_cart
Purpose: Tracks products added to cart
Extracted field | JSON path in |
|---|---|
SKU |
|
Product title |
|
Variant title |
|
Product type |
|
Product vendor |
|
Variant ID |
|
Product ID |
|
Quantity |
|
Line cost |
|
Currency code |
|
(event count) | — |
Minimum required payload:
{
"cartLine": {
"quantity": 1,
"merchandise": {
"sku": "...",
"id": "...",
"title": "...",
"product": {
"id": "...",
"title": "...",
"type": "...",
"vendor": "..."
}
},
"cost": {
"totalAmount": {
"amount": "29.99",
"currencyCode": "USD"
}
}
}
}
product_removed_from_cart
Purpose: Tracks products removed from cart. Same structure as product_added_to_cart.
Extracted field | JSON path in |
|---|---|
SKU |
|
Product title |
|
Variant title |
|
Product type |
|
Product vendor |
|
Variant ID |
|
Product ID |
|
Quantity |
|
Line cost |
|
(event count) | — |
Minimum required payload: Same structure as product_added_to_cart.
cart_viewed
Purpose: Tracks cart page views
Extracted field | JSON path in |
|---|---|
Cart total |
|
Cart quantity |
|
Currency code |
|
(event count) | — |
Minimum required payload:
{
"cart": {
"totalQuantity": 3,
"cost": {
"totalAmount": {
"amount": "89.97",
"currencyCode": "USD"
}
}
}
}
checkout_started
Purpose: Snapshot of cart at checkout initiation
Extracted field | JSON path in |
|---|---|
Line items |
|
— Line item SKU |
|
— Line item title |
|
— Variant title |
|
— Product type |
|
— Product vendor |
|
— Variant ID |
|
— Product ID |
|
— Quantity |
|
Pricing | |
Subtotal |
|
Shipping |
|
Tax |
|
Total |
|
Discounts | |
Discount codes |
|
Discount types |
|
Discount amount |
|
Has discount |
|
Other | |
Currency code |
|
Cart quantity | (sum of lineItems[].quantity) |
(event count) | — |
Minimum required payload:
{
"checkout": {
"currencyCode": "USD",
"lineItems": [
{
"title": "...",
"quantity": "1",
"variant": {
"sku": "...",
"id": "...",
"title": "...",
"product": { "id": "...", "type": "...", "vendor": "..." }
}
}
],
"subtotalPrice": { "amount": "..." },
"shippingLine": { "price": { "amount": "..." } },
"totalTax": { "amount": "..." },
"totalPrice": { "amount": "..." },
"discountsAmount": { "amount": "..." },
"discountApplications": [
{ "title": "...", "type": "..." }
]
}
}
checkout_contact_info_submitted
Purpose: Tracks that the user submitted contact info during checkout.
Extracted field | JSON path in |
|---|---|
Has discount |
|
(event count) | — |
Minimum required payload: None needed beyond ecomm_name. Discount detection only needs the array to exist (can be empty []).
checkout_address_info_submitted
Purpose: Tracks address submission and delivery options
Extracted field | JSON path in |
|---|---|
Delivery option names |
|
Delivery option types |
|
(event count) | — |
Minimum required payload:
{
"checkout": {
"delivery": {
"selectedDeliveryOptions": [
{ "title": "Standard Shipping", "type": "SHIPPING" }
]
}
}
}
checkout_shipping_info_submitted
Purpose: Tracks shipping info submission
Extracted field | JSON path in |
|---|---|
Delivery option names |
|
Delivery option types |
|
(event count) | — |
Minimum required payload: Same as checkout_address_info_submitted.
payment_info_submitted
Purpose: Tracks payment info submission
Extracted field | JSON path in |
|---|---|
Delivery option names |
|
Delivery option types |
|
Payment gateways |
|
Payment method types |
|
Payment method names |
|
Total price |
|
Cart quantity | (sum of lineItems[].quantity) |
Currency code |
|
Has discount |
|
(event count) | — |
Minimum required payload:
{
"checkout": {
"currencyCode": "USD",
"totalPrice": { "amount": "..." },
"delivery": {
"selectedDeliveryOptions": [
{ "title": "...", "type": "..." }
]
},
"transactions": [
{
"gateway": "shopify_payments",
"paymentMethod": { "type": "CREDIT_CARD", "name": "Visa" }
}
],
"discountApplications": []
}
}
checkout_completed
Purpose: Final order snapshot
Extracted field | JSON path in |
|---|---|
Line items |
|
— SKU, title, variant, type, vendor, IDs, quantity | (same paths) |
Pricing | |
Subtotal |
|
Shipping |
|
Tax |
|
Total |
|
Discounts | |
Discount codes |
|
Discount types |
|
Discount amount |
|
Has discount |
|
Order info | |
Order ID |
|
Customer ID |
|
Delivery | |
Delivery names |
|
Delivery types |
|
Payment | |
Payment gateways |
|
Payment method types |
|
Payment method names |
|
Other | |
Currency code |
|
Cart quantity | (sum of lineItems[].quantity) |
(event count) | — |
Minimum required payload:
{
"checkout": {
"currencyCode": "USD",
"order": {
"id": "...",
"customer": { "id": "..." }
},
"lineItems": [
{
"title": "...",
"quantity": "1",
"variant": {
"sku": "...",
"id": "...",
"title": "...",
"product": { "id": "...", "type": "...", "vendor": "..." }
}
}
],
"subtotalPrice": { "amount": "..." },
"shippingLine": { "price": { "amount": "..." } },
"totalTax": { "amount": "..." },
"totalPrice": { "amount": "..." },
"discountsAmount": { "amount": "..." },
"discountApplications": [
{ "title": "...", "type": "..." }
],
"delivery": {
"selectedDeliveryOptions": [
{ "title": "...", "type": "..." }
]
},
"transactions": [
{
"gateway": "...",
"paymentMethod": { "type": "...", "name": "..." }
}
]
}
}