Skip to content

Usage Overview

For developers

Where every event is emitted across the example app and shared providers. Pair this with the Event Reference.

Event usage map in this repository

App-level (Expo Event Playground)

example/src/App.tsx is the running example entry (example/index.js registers it). It:

  • constructs Initialize with SEGMENTIFY_CONFIGURATION and calls triggerInitialPageView('Home') on mount
  • uses one Events instance (SegmentifyEvents) for almost all demo calls, plus static Events.subscribePushNotification / Events.pushNotificationInteraction for push (same class, no instance required)
  • renders a scrollable Event Playground: one button per demo event, plus an Event Inspector (payload, normalized HTTP response, userId, sessionId, copy-to-clipboard)
  • before each demo send, calls getOrSetUserSessionId() so the inspector always reflects the IDs used for that request
  • outside Expo Go (Constants.appOwnership !== 'expo'), boots PushService for permission, listeners, and in-app push state; Push Subscribe uses the static Events.subscribePushNotification (see Push Notification Events)

Playground buttons map to SDK methods as follows (each links to the relevant event reference section). For exact demo objects (search, interaction, basket, identity, push), see Search, Interaction, Form and Custom — section Event Playground.

Playground labelSDK callEvent reference
PageViewPageViewPage and Product
Interaction Click / ViewInteractionSearch, Interaction, Form and Custom
ProductViewProductViewPage and Product
Before Search, After Search, SearchandisingSearchSearch, Interaction, Form and Custom
Before / After / Searchandising interaction rowsInteractionSearch, Interaction, Form and Custom
Basket View / Add / Remove, Order Success, BasketClearBasketView, BasketAdd, BasketRemove, Purchase, BasketClearCheckout and Basket
FavoriteAdd / Remove / ViewFavoriteAdd, FavoriteRemove, FavoriteViewUser and Wishlist
Identify, Register, LogIn (button) / LogoutIdentify, Register, Login, LogoutUser and Wishlist
User Traits, [CDP] Identify / Register / Login / Logout UserUserTraits, IdentifyUser, RegisterUser, LoginUser, LogoutUserCustomer Data Platform
[CDP] Email / WhatsApp / SMS / Call Subscribe and UnsubscribeSubscribeUser, UnsubscribeUserCustomer Data Platform
Email User OP, Email Interaction Click, SMS Interaction ClickInteraction (cross-channel / campaign shapes)Search, Interaction, Form and Custom
Push SubscribeEvents.subscribePushNotificationPush Notification Events
Push Interaction VIEW / CLICKEvents.pushNotificationInteractionPush Notification Events

The LogIn playground button calls the SDK method Login (sign-in USER_OPERATIONS step), not a separate LogIn symbol.

Playground buttons (order in App.tsx)

PageViewInteraction ClickInteraction ViewProductViewBefore SearchBefore Search Interaction ClickBefore Search Interaction ViewBefore Search Interaction ImpressionAfter SearchAfter Search Interaction ClickAfter Search Interaction ViewAfterSearch Interaction ImpressionSearchandisingSearchandising ClickBasket ViewBasket AddOrder SuccessBasket RemoveBasketClearFavoriteAddFavoriteRemoveFavoriteViewIdentifyRegisterLogInLogoutUser Traits[CDP] Identify User[CDP] Register User[CDP] Login User[CDP] Logout User[CDP] Email Subscribe[CDP] WhatsApp Subscribe[CDP] SMS Subscribe[CDP] Call Subscribe[CDP] Email Unsubscribe[CDP] WhatsApp Unsubscribe[CDP] SMS Unsubscribe[CDP] Call UnsubscribePush SubscribePush Interaction VIEWPush Interaction CLICKEmail User OPEmail Interaction ClickSMS Interaction Click.

The label AfterSearch Interaction Impression is copied verbatim from App.tsx (no space after “After”); you may rename it locally for clarity.

In Expo Go, Firebase push is not initialized; use a dev client or release build to exercise Push Subscribe and live notifications. PushService still documents receive/open hooks that emit push VIEW / CLICK in a full native setup.

Screen-level (reference UI, not the default entry)

Under example/src/screens/, components illustrate production-style screen wiring (e.g. ProductView on product open). They are useful patterns when you replace the playground with real navigation; see Screen Flows.

Shared-hook-level

  • shared/hooks/useCart.tsxBasketAdd, BasketRemove, BasketClear
  • shared/hooks/useWishlist.tsxFavoriteAdd, FavoriteRemove
  • shared/hooks/useAuth.tsxLogout

Push-service-level

  • example/src/services/PushService.ts — permission, token, retries, receive/open listeners; calls Events.pushNotificationInteraction for VIEW / CLICK where configured

For step-by-step walkthroughs, continue with Screen Flows and Shared Hooks.