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 noNavigationContainerin this entry—addonStateChange={segmentify.navigationObserver}in your own app when you use React Navigation. - Outside Expo Go,
PushServiceis created and permission/listeners are configured.
Configuration fields and meaning
From shared/segmentify-configuration.ts:
pageTypeMapping: route-to-page type map used byNavigationObserverloggerOptions.debugMode: enable SDK debug loggingconfig.segmentifyApiUrl: event API domainconfig.segmentifyPushUrl: push API domainconfig.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:
deviceuserIdsessionIdcurrencylangososversiontestModeemail(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
NavigationContainerstate changes are connected. - Keep
pageTypeMappingsynchronized with real screen names. - Set user identity (
Initialize.setUseror user operation events) after login/register. - Send cart/wishlist/purchase events from clear business actions.