Track Events Emitted By Nobi

TRACK NOBI EVENTS YOURSELF

Tracking Events From Nobi


Nobi automatically emits analytics events that merchants can capture for their internal analytics, A/B testing, and business intelligence. This guide explains how to capture these events and what data they contain.

Overview

Nobi emits events through the following channels:
  1. Window Events - Custom events dispatched to window for merchant capture
  1. Shopify Analytics - Native Shopify analytics events (for Shopify stores)

Emitted events

For every Nobi event, there are two dispatched events:
  1. Generic nobi-analytics event - This fires for all Nobi events and contains the specific event name in the detail.event property
  1. Specific event - Like nobi-search, etc.
For example, when a user searches, Nobi dispatches:
  • nobi-analytics with detail: { event: "Search", data: {...} }
  • nobi-search with detail: { event: "Search", data: {...} }
When a product is added to cart, we dispatch:
  • nobi-analytics with detail: { event: "Product Added To Cart", data: {...} }
  • nobi-search: { event: "Search", data: {...} }
The nobi-analytics listener captures all events because it's a catch-all that fires for every single Nobi event. The specific
event name is passed in the detail.event property.
This gives you two options:
  1. Listen to everything: addEventListener('nobi-analytics', ...)
  1. Listen to specific events: addEventListener('nobi-search', ...)

Capturing Events

Window Event Listeners

All Nobi events are dispatched as custom events to the browser's window object. You can capture them using standard JavaScript event listeners:
// Listen to all Nobi events window.addEventListener('nobi-analytics', function(event) { const { event: eventName, data, timestamp, source } = event.detail; // Send to your analytics platform analytics.track(eventName, { ...data, timestamp, source }); }); // Listen to specific event types window.addEventListener('nobi-search', function(event) { console.log('User performed a search:', event.detail); });

Event Structure

All Nobi events follow this structure:
{ detail: { event: "Search", // Event name data: { // Event-specific data query: "red sweater", searchEngine: "Nobi", // ... other properties }, timestamp: "2024-01-15T10:30:00Z", // ISO timestamp source: "nobi" // Always "nobi" } }

Event Reference

Search Events

Search
Event Name: Search
Window Event: nobi-search
Description: Fired when a user performs any search
Data Properties:
  • query (string) - The search query
  • searchEngine (string) - "Nobi", "Shopify Default", or site-specific
  • conversationId (string, optional) - Associated conversation ID
  • entryPoint (string) - How user accessed search ("SearchBar", "Cart", etc.)
// Example { event: "Search", data: { query: "red sweater", searchEngine: "Nobi", conversationId: "conv_123", entryPoint: "SearchBar", shopperId: "shopper_456", isMobile: false, pageUrl: "https://store.com/search" } }
Search On Nobi
Event Name: Search On Nobi
Window Event: nobi-search-on-nobi
Description: Specifically fired when user searches using Nobi AI

User Interface Events

Click On Search Result
Event Name: Click On Search Result
Window Event: nobi-click-on-search-result
Description: Fired when user clicks on a product in search results
Data Properties:
  • productVariantId (string) - Clicked variant ID
  • productId (string) - Product ID
  • position (number) - Position in search results (0-indexed)
  • query (string) - Original search query
  • recommendationStrategy (string, optional) - Recommendation algorithm used
Click On Search Icon
Event Name: Click On Search Icon
Window Event: nobi-click-on-search-icon
Description: Fired when user clicks the search icon to expand search bar
Click Search With AI Button
Event Name: Click Search With AI Button
Window Event: nobi-click-search-with-ai-button
Description: Fired when user clicks the "Search with AI" button
Shop With AI Button Shown
Event Name: Shop With AI Button Shown
Window Event: nobi-shop-with-ai-button-shown
Description: Fired when the "Shop with AI" button is displayed to user
Close Drawer
Event Name: Close Drawer
Window Event: nobi-close-drawer
Description: Fired when user closes the chat drawer or search interface

Chat and Conversation Events

Send Message
Event Name: Send Message
Window Event: nobi-send-message
Description: Fired when user sends a message to Nobi
Data Properties:
  • message (string) - The message content
  • conversationId (string) - Conversation ID
  • messageNumber (number) - Message sequence number
Start New Conversation
Event Name: Start New Conversation
Window Event: nobi-start-new-conversation
Description: Fired when user starts a new conversation with Nobi
Chatbot Viewed
Event Name: Chatbot Viewed
Window Event: nobi-chatbot-viewed
Description: Fired when the chatbot interface is displayed

Product Collection Events

Displayed Product Collection
Event Name: Displayed Product Collection
Window Event: nobi-displayed-product-collection
Description: Fired when a product collection is shown to user
Data Properties:
  • collectionId (string) - Collection ID
  • numberOfVariants (number) - Number of products shown
  • collectionName (string) - Collection name/title
Click Expand Product Collection Button
Event Name: Click Expand Product Collection Button
Window Event: nobi-click-expand-product-collection-button
Description: Fired when user expands a product collection to see more items
Click Collapse Product Collection Button
Event Name: Click Collapse Product Collection Button
Window Event: nobi-click-collapse-product-collection-button
Description: Fired when user collapses a product collection

Recommendation Events

These events will only apply to customers who use Nobi’s AI-generated cross-sell recommendations
Request Product Recommendations
Event Name: Request Product Recommendations
Window Event: nobi-request-product-recommendations
Description: Fired when user requests product recommendations
PDP Recommendations Loaded
Event Name: PDP Recommendations Loaded
Window Event: nobi-pdp-recommendations-loaded
Description: Fired when product recommendations load on product detail pages

Custom Instruction Events

Click Custom Pill
Event Name: Click Custom Pill
Window Event: nobi-click-custom-pill
Description: Fired when user clicks a custom instruction pill/suggestion
Data Properties:
  • pillText (string) - Text of the clicked pill
  • customInstructionId (string) - ID of the custom instruction

Common Event Properties

All events automatically include these common properties:
  • conversationId (string, optional) - Associated conversation ID
  • entryPoint (string) - How user accessed Nobi ("SearchBar", "Cart", "PDP")
  • shopperId (string) - Unique shopper identifier (persisted in localStorage)
  • isMobile (boolean) - Whether user is on mobile device
  • pageUrl (string) - Current page URL
  • timestamp (string) - ISO timestamp when event occurred
  • source (string) - Always "nobi"

Merchant Information

When available, events may also include:
  • Nobi Merchant Name (string) - Your store name in Nobi

Implementation Examples

Google Analytics 4

// Track all Nobi events in GA4 window.addEventListener('nobi-analytics', function(event) { const { event: eventName, data } = event.detail; gtag('event', eventName.toLowerCase().replace(/\s+/g, '_'), { event_category: 'nobi', ...data }); });

Segment

// Track Nobi events with Segment window.addEventListener('nobi-analytics', function(event) { const { event: eventName, data } = event.detail; analytics.track(eventName, { ...data, source: 'nobi' }); });

Custom Analytics

// Send to your custom analytics endpoint window.addEventListener('nobi-analytics', function(event) { const { event: eventName, data, timestamp } = event.detail; fetch('/api/analytics/track', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ event: eventName, properties: data, timestamp: timestamp, source: 'nobi' }) }); });

Shopify Analytics Integration

For Shopify stores, Nobi also publishes events to Shopify's native analytics system. These events are automatically available in:
  • Shopify Admin Analytics
  • Shopify Scripts
  • Shopify Flow
  • Third-party apps that use Shopify's Web Pixels API

Shopify Event Names

Nobi publishes these events to Shopify Analytics:
  • Custom Nobi events (non-Shopify native events)
  • All events except: product_added_to_cartproduct_viewedsearch_submittedproduct_removed_from_cartcheckout_completed (these are native Shopify events)

Privacy and Data Handling

User Privacy

  • Events include a unique shopperId that persists across sessions but doesn't contain PII
  • No email addresses, names, or other personal information are included in events
  • IP addresses are not included in event data

GDPR Compliance

  • The shopperId can be reset by clearing localStorage
  • All event data is aggregated and anonymized in Nobi's systems
  • Merchants are responsible for obtaining appropriate consent for their own analytics tracking

Data Retention

  • Window events are ephemeral and only exist in the browser session
  • Merchants control retention of captured event data in their own systems
  • Nobi retains aggregated analytics data according to our privacy policy

Troubleshooting

Events Not Firing

  1. Check browser console for JavaScript errors
  1. Verify Nobi is properly initialized on your site
  1. Test with the browser's developer tools:
    1. // Check if events are being dispatched window.addEventListener('nobi-analytics', function(event) { console.log('Nobi Event:', event.detail); });

Missing Event Data

  • Some properties are only available in certain contexts (e.g., conversationId only exists during chat sessions)
  • Shopify-specific data (like product IDs) only exists on Shopify stores
  • Mobile detection may vary based on device and browser

Event Timing

  • Events are dispatched synchronously when actions occur
  • Network delays may affect when your analytics platform receives the data
  • Some events (like Checkout Completed) may fire with a slight delay due to Shopify's event timing