@deeptaai/klaritics-react-native-sdk
v1.0.0
Published
React Native Klaritics SDK
Readme
Description
React Native SDK for Klaritics. You write your integration once in JavaScript — the same code runs on both Android and iOS. You never write native Java/Kotlin or Swift/Objective-C.
🏁 Getting Started
Install the package:
npm install @deeptaai/klaritics-react-native-sdk
# or
yarn add @deeptaai/klaritics-react-native-sdkReact Native 0.60+ autolinks the native module, so there is no react-native link,
no MainApplication edits, and no settings.gradle changes.
- Android — ready after install. See Android.
- iOS — run
pod install; the Klaritics core is fetched and wired automatically. See iOS.
⚙️ Initialize
Wrap your app in KlariticsProvider — this is the only setup you write, and it initializes
the SDK on both platforms:
import { KlariticsProvider } from '@deeptaai/klaritics-react-native-sdk'
export default function App() {
return (
<KlariticsProvider apiKey="YOUR_APP_ID" options={{ host: 'YOUR_HOST' }}>
{/* your app */}
</KlariticsProvider>
)
}Prefer to initialize imperatively? Call setup once, early in your app's lifecycle:
import { setup } from '@deeptaai/klaritics-react-native-sdk'
setup('YOUR_APP_ID', { host: 'YOUR_HOST' })The app id and host are provided here at runtime — you do not put them in
AndroidManifest.xml,Info.plist, or Gradle.
🤖 Android
The Klaritics Android SDK is pulled in automatically via autolinking — the AAR is declared
as a dependency of this package and resolved from its Maven repository at build time. There are
no manual steps: no MainApplication edits, no manifest meta-data, and no app id in Gradle.
If Android dependency resolution fails because your app uses Gradle's centralized
dependencyResolutionManagementwithRepositoriesMode.FAIL_ON_PROJECT_REPOS, add the Klaritics Maven repo toandroid/settings.gradle:dependencyResolutionManagement { repositories { maven { url "https://asia-south1-maven.pkg.dev/org-infra-471907/klaritics-android-sdk" } } }
🍎 iOS
iOS is zero-config — just run pod install:
npm install @deeptaai/klaritics-react-native-sdk
cd ios && pod installReact Native autolinking picks up this package's podspec, which fetches the prebuilt Klaritics core framework and wires up the headers, linking, and embedding for you. There are no Xcode steps, no Podfile edits, and nothing to add manually — this mirrors how the Android side pulls the core from Maven.
Then initialize from JavaScript exactly as shown in Initialize — the same
KlariticsProvider / setup call drives iOS. No AppDelegate code is required.
🚀 API & Usage
Imports
// Import the SDK as a module
import Klaritics from '@deeptaai/klaritics-react-native-sdk'
// Or, import required functions
import { logAppEvent, trackScreen } from '@deeptaai/klaritics-react-native-sdk'Set Custom User IDs
// Syntax
Klaritics.setUserIdentifier('user_id')
// Example
Klaritics.setUserIdentifier('[email protected]')Set Custom User and Session Properties
// Syntax
Klaritics.setUserCustomInfo(properties)
Klaritics.setSessionCustomInfo(properties)
// Example
Klaritics.setUserCustomInfo({
city: 'Hyderabad',
age: 12,
})Logging Events
// Syntax
Klaritics.logAppEvent(event_name, properties)
// Example
Klaritics.logAppEvent('ADD_TO_CART', {
userId: '[email protected]',
value: 1299,
item: 'Sony Head Phone 1201',
})