Skip to content

Event Overview

For developers

The map of all event families and how runtime payloads are built. For the business meaning of each family, see the Event Catalog (Plain Language).

Event families in this SDK

src/classes/events.ts defines these runtime event families:

  • PAGE_VIEW
  • PRODUCT_VIEW
  • SEARCH
  • CHECKOUT (view-basket, purchase, customer-info, payment-info)
  • BASKET_OPERATIONS (add, remove, clear)
  • WISHLIST (add, remove, detail, view-favorites)
  • USER_OPERATIONS (update, iyspermissions, signup, signin, signout)
  • USER_TRAITS (UserTraits)
  • USER_IDENTIFY (IdentifyUser)
  • USER_REGISTER / USER_LOGIN / USER_LOGOUT (RegisterUser, LoginUser, LogoutUser)
  • USER_SUBSCRIBE / USER_UNSUBSCRIBE (SubscribeUser, UnsubscribeUser)
  • INTERACTION
  • FORM
  • CUSTOM_EVENT

Push has dedicated static methods (separate endpoints):

  • Events.subscribePushNotification()
  • Events.pushNotificationInteraction()

Payload lifecycle in sendEvent()

Every call to events.sendEvent(payload) is enriched with values sourced from SDK config and storage:

  • device
  • userId
  • sessionId
  • currency
  • lang
  • os
  • osversion
  • testMode
  • email (if a user object exists in storage)

Storage keys used during this flow are from src/constants/keys.ts, especially:

  • SEGMENTIFY_CONFIG
  • SEGMENTIFY_DEVICE
  • SEGMENTIFY_USER
  • SEGMENTIFY_USER_ID
  • SEGMENTIFY_USER_PROFILE (CDP IdentifyUser dedup snapshot)
  • SEGMENTIFY_SESSION_ID
  • SEGMENTIFY_EVENT_QUEUE

Queue and replay behavior

nextPage queue

If payload has nextPage: true, SDK does not send network request immediately. It appends payload into SEGMENTIFY_EVENT_QUEUE and returns.

Offline queue

When network is offline, offlineEventLogic() attempts to append payload into the same queue.

Online replay

When network is online, onlineEventLogic() replays queued events through sendEvent() and clears queue afterward.

Naming pattern

A payload usually includes:

  • name: event family (required)
  • step: sub-action for some families
  • event-specific fields (productId, totalPrice, etc.)

Type source of truth vs runtime source of truth

  • Type contracts: src/types.ts
  • Runtime behavior: src/classes/events.ts

Use both together. Type definitions define the integration contract, while runtime code defines enrichment and transport behavior.

Known runtime examples

  • ProductView stringifies each params value before send.
  • Interaction may copy instanceId into interactionId.
  • Purchase requires orderNo by type and the example app now uses orderNo in checkout success flow.

See Known Gotchas for complete mismatch list.

Start here if you are new

Jump to detailed references