Skip to content

Project Setup

For developers

Repository-specific setup: where initialization, config, and navigation tracking live in this codebase, and what the SDK enriches for you.

Where setup happens in this repository

  • App bootstrap: example/src/App.tsx
  • Config object: shared/segmentify-configuration.ts
  • SDK initialization internals: src/classes/initialize.ts
  • Navigation to page-view bridge: src/classes/navigation-observer.ts

App root integration

In example/src/App.tsx (Event Playground):

  • new Initialize(SEGMENTIFY_CONFIGURATION) creates the SDK instance.
  • triggerInitialPageView('Home') sends the first page hit.
  • Demo PageView and other events are sent from buttons (see Usage Overview); there is no NavigationContainer in this entry—add onStateChange={segmentify.navigationObserver} in your own app when you use React Navigation.
  • Outside Expo Go, PushService is created and permission/listeners are configured.

Configuration fields and meaning

From shared/segmentify-configuration.ts:

  • pageTypeMapping: route-to-page type map used by NavigationObserver
  • loggerOptions.debugMode: enable SDK debug logging
  • config.segmentifyApiUrl: event API domain
  • config.segmentifyPushUrl: push API domain
  • config.testMode: test payload flag

If route names are not in pageTypeMapping, PAGE_VIEW still sends with Unknown Page, but your reporting quality decreases.

Automatic enrichment on every event

Events.sendEvent() enriches outgoing payloads with:

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

You do not need to pass these manually in normal flows.

Minimum production checklist

  • Initialize SDK exactly once in app startup.
  • Ensure NavigationContainer state changes are connected.
  • Keep pageTypeMapping synchronized with real screen names.
  • Set user identity (Initialize.setUser or user operation events) after login/register.
  • Send cart/wishlist/purchase events from clear business actions.