Branch Web SDK API Reference Overview
mainThe Branch Web SDK provides a suite of methods for managing user sessions, tracking events, handling deep linking, and managing user privacy. The API is organized into the following functional areas:
1. Branch Session
Manage the user's lifecycle and identity within the SDK.
.init(branch_key, options, callback): Initialize the SDK..data(callback): Retrieve session data..first(callback): Check if it is the user's first session..setIdentity(identity, callback): Set user identity..logout(callback): Log the user out..crossPlatformIds(callback): Retrieve cross-platform identifiers..lastAttributedTouchData(attribution_window, callback): Get attribution data.
2. Event Tracking
Record user actions and custom events.
.track(event, metadata, callback): Track standard events..logEvent(event, event_data_and_custom_data, content_items, callback): Log specific events with detailed data.
3. Deep Linking
Handle incoming links and deep view experiences.
.link(data, callback): Create or process links..deepview(data, options, callback): Trigger a deep view experience..deepviewCta(): Handle deep view Call to Action.
4. Event Listener
Subscribe to SDK events.
.addListener(event_listener): Add a listener..removeListener(listener): Remove a listener.
5. Journeys Web To App
Manage the transition from web to mobile applications.
.setBranchViewData(data): Set data for the web-to-app journey..closeJourney(): Close the current journey.
6. Revenue Analytics
Track commerce-related data.
.trackCommerceEvent(event, commerce_data, metadata, callback): Track revenue and commerce events.
7. User Privacy
Control data collection.
.disableTracking(disableTracking): Enable or disable tracking.