Docs SDK reference Events tracked by default

Events Reference

Complete reference for all events tracked by the elNudge SDK — auto-detected and manual.

elNudge tracks two categories of events:

  • Auto-detected — fired automatically by the SDK with no code required.
  • Manual — fired by your code at the right moment in the user journey.

Every event is wrapped in a standard envelope before being sent to the platform.

Event envelope

All events, whether auto-detected or manual, are sent in this envelope:

{
  "session_id": "ses_01HXXXXX",
  "site_key": "sk_live_XXXXXXXX",
  "event": "CART_ADD",
  "ts": "2026-05-02T10:34:21.451Z",
  "url": "https://yourstore.com/products/headphones",
  "data": { }
}
FieldTypeDescription
session_idstringCurrent session (ses_01HXXXXX)
site_keystringYour site key
eventstringEvent name (see below)
tsstringISO 8601 UTC timestamp
urlstringFull URL at time of event
dataobjectEvent-specific payload

Auto-detected events

These fire without any code on your part.

PAGE_VIEW

Fires on every page load and on SPA route changes.

{
  "event": "PAGE_VIEW",
  "data": {
    "url": "https://yourstore.com/products/headphones",
    "referrer": "https://google.com",
    "title": "Wireless Headphones — YourStore"
  }
}

SCROLL_DEPTH

Fires once per threshold per page: 25 %, 50 %, 75 %, 100 %.

{
  "event": "SCROLL_DEPTH",
  "data": {
    "depth": 75,
    "url": "https://yourstore.com/products/headphones"
  }
}

ELEMENT_HOVER

Fires when a visitor hovers over a product element (image, price, add-to-cart button) for more than two seconds. The SDK identifies product elements using common selectors — [data-product-id], .product, .product-card, etc.

{
  "event": "ELEMENT_HOVER",
  "data": {
    "selector": ".product-card",
    "duration_ms": 2340,
    "text": "Wireless Headphones"
  }
}

CLICK

Fires on every user click. The SDK records the element's tag, class list, and text content — not raw coordinates.

{
  "event": "CLICK",
  "data": {
    "tag": "BUTTON",
    "classes": ["btn", "btn-primary", "add-to-cart"],
    "text": "Add to cart"
  }
}

EXIT_INTENT

Fires once per page when the visitor's cursor moves above the top 10 % of the viewport (desktop) or when the browser back gesture is detected (mobile).

{
  "event": "EXIT_INTENT",
  "data": {
    "url": "https://yourstore.com/products/headphones"
  }
}

TAB_SWITCH

Fires when the visitor switches to a different browser tab (Page Visibility API visibilitychange).

{
  "event": "TAB_SWITCH",
  "data": {
    "state": "hidden"
  }
}

A second event fires when they return:

{
  "event": "TAB_SWITCH",
  "data": {
    "state": "visible"
  }
}

IDLE

Fires at four inactivity thresholds: 15 s, 30 s, 45 s, and 120 s. Any user interaction (mouse move, scroll, keypress, touch) resets the idle timer.

{
  "event": "IDLE",
  "data": {
    "duration_s": 30
  }
}

Manual events

Fire these from your own code at the appropriate moments in the user journey.

CART_ADD

Fire when a visitor adds a product to their cart.

window.__eln('track', 'CART_ADD', {
  product_id: 'prod_abc123',
  product_name: 'Wireless Headphones',
  variant_id: 'var_blue_lg',
  price: 2999,       // smallest currency unit (paise, cents, etc.)
  currency: 'INR',
  quantity: 1,
})
{
  "event": "CART_ADD",
  "data": {
    "product_id": "prod_abc123",
    "product_name": "Wireless Headphones",
    "variant_id": "var_blue_lg",
    "price": 2999,
    "currency": "INR",
    "quantity": 1
  }
}

CART_REMOVE

Fire when a visitor removes a product from their cart.

window.__eln('track', 'CART_REMOVE', {
  product_id: 'prod_abc123',
  variant_id: 'var_blue_lg',
})

PURCHASE

Fire when an order is confirmed. Include all line items for accurate revenue attribution.

window.__eln('track', 'PURCHASE', {
  order_id: 'ord_001234',
  total: 5998,
  currency: 'INR',
  line_items: [
    {
      product_id: 'prod_abc123',
      product_name: 'Wireless Headphones',
      variant_id: 'var_blue_lg',
      price: 2999,
      quantity: 2,
    },
  ],
})

PRODUCT_VIEW

Fire when a visitor lands on a product detail page or when a product modal/drawer opens.

window.__eln('track', 'PRODUCT_VIEW', {
  product_id: 'prod_abc123',
  product_name: 'Wireless Headphones',
  price: 2999,
  currency: 'INR',
  category: 'Electronics',
  tags: ['wireless', 'noise-cancelling'],
})

SEARCH_QUERY

Fire when a visitor submits a search query.

window.__eln('track', 'SEARCH_QUERY', {
  query: 'wireless headphones',
  result_count: 12,
})

CHECKOUT_STAGE

Fire at each step of your checkout funnel. Use consistent stage names across sessions.

window.__eln('track', 'CHECKOUT_STAGE', {
  stage: 'shipping_info',   // e.g. 'cart', 'shipping_info', 'payment', 'review'
  cart_total: 5998,
  currency: 'INR',
})

CUSTOM

Fire any event that does not fit the above categories. Use a consistent name value so the platform can aggregate across sessions.

window.__eln('track', 'CUSTOM', {
  name: 'WISHLIST_ADD',
  product_id: 'prod_abc123',
  product_name: 'Wireless Headphones',
})

The name field is required for CUSTOM events. All other fields are passed through as-is.