Tracking UI events will help us determine how successful your app is. This can hook into any user-generated events that you deem important to track like choosing a product, updating a description, choosing a new asset, etc.

The Unbounce SDK includes a handy function called createUIEventTracking that can help track these UI events.

When you call on createUIEventTracking event, you’ll receive two methods:

  1. useUIEvents and
  2. UIEventProvider.

So, as a helpful tip to note: try to use this method in a separate file so that you can reuse it properly along with other files that might require them:

import { createUIEventTracking } from 'smart-builder-sdk';

interface EventName {
  // List all the events to be sent in your app with a descriptive name and prefixed by SMART_BUILDER_SMART_APPS_
  SMART_BUILDER_SMART_APPS_MY_APP_FIRST_EVENT: 'The first event I send';
  SMART_BUILDER_SMART_APPS_MY_APP_SECOND_EVENT: 'The second event I send';
  SMART_BUILDER_SMART_APPS_MY_APP_THIRD_EVENT: 'The third event I send';
}

interface Workflow {
  // The workflow will most likely always be smart_builder_apps, reach out to us if you want to implement a different one
  smart_builder_apps: 'Apps interactions and flows';
}

export const { useUIEvents, UIEventProvider } = createUIEventTracking<EventName, Workflow>();

useUIEvents

This method returns two more:

  1. sendEvent and
  2. sendBatchEvents

1. sendEvent