Registry / communication / clevertap-react-native

clevertap-react-native

JSON →
library4.1.0jsnpmunverified

CleverTap React Native SDK v4.1.0 provides a native bridge to CleverTap's mobile customer engagement and analytics platform for React Native apps (requires react-native >=0.65.0). The SDK supports push notifications, in-app notifications (including Picture-in-Picture, GIF, and video), user segmentation, event tracking, and A/B testing. It ships with TypeScript definitions and supports New Architecture on React Native >=0.71. Releases typically align with CleverTap’s iOS and Android SDKs every few months. Key differentiators: native performance, deep integration with CleverTap's dashboard, and support for rich media in-app templates.

npm install clevertap-react-native
INSTALL
IMPORT
SIG · CLEVERTAP-REACT-NA
C
clevertap-react-native
communicationjavascriptv4.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default import
import CleverTap from 'clevertap-react-native';
const CleverTap = require('clevertap-react-native');
The default import is the recommended way to use the SDK. CommonJS require() may work but is not recommended for ESM projects.
CleverTap
import CleverTap from 'clevertap-react-native';
import { CleverTap } from 'clevertap-react-native';
The SDK exports a default object, not a named export. Named import will result in undefined.
registerForPush
import CleverTap from 'clevertap-react-native'; CleverTap.registerForPush();
CleverTap.registerForPush()
registerForPush is a method on the default export, not a standalone function.
onUserLogin
import CleverTap from 'clevertap-react-native'; CleverTap.onUserLogin({...});
CleverTap.onUserLogin(...)
onUserLogin accepts a profile object. For older versions (<3.0), the method was 'onUserLogin' with callback; check changelog for breaking changes.

Basic setup: record events, set user profile, register push, and trigger in-app notifications.

import CleverTap from 'clevertap-react-native'; // Initialize (auto if installed correctly) // Record an event CleverTap.recordEvent('Product Viewed', { 'Product Name': 'Casio Watch', 'Category': 'Mens Accessories' }); // Set user profile CleverTap.onUserLogin({ 'Name': 'John Doe', 'Email': 'john.doe@example.com', 'Phone': '+14155551234' }); // Register for push notifications CleverTap.registerForPush(); // Fetch in-app notifications CleverTap.recordEvent('App Launched');
Debug
Known issues
breakingv4.0.0 requires React Native >=0.65.0 and drops support for older versions.
fix
Update react-native to >=0.65.0. See the version support table in README.
affects: >=4.0.0
gotchaDefault import only: using named import `{ CleverTap }` results in undefined.
fix
Use `import CleverTap from 'clevertap-react-native'`.
affects: >=3.0.0
deprecatedThe `onUserLogin` callback signature changed in v3.0.0; old callback style no longer works.
fix
Migrate to new signature: `CleverTap.onUserLogin(profileObject)`.
affects: <3.0.0
gotchaiOS Push Templates SDK requires additional setup: follow docs/iospushtemplates.md.
fix
Integrate push templates as per the documentation.
affects: >=3.0.0
gotchaAndroid: for Huawei push, changed integration steps since v3.4.0. See guide.
fix
Refer to the CleverTap Huawei Push Integration guide.
affects: >=3.4.0
Errors
Common errors & fixes
Error: `CleverTap` is undefined when using `import { CleverTap } from 'clevertap-react-native'`
Wrong import syntax: named import instead of default import.
fix
Use `import CleverTap from 'clevertap-react-native'`.
TypeError: CleverTap.recordEvent is not a function
Importing the module incorrectly or using an outdated version of the SDK.
fix
Ensure you are using default import and the SDK version is >=3.0.0.
Native Module: CleverTap is undefined (React Native)
Native module not linked properly (for RN <0.60) or pods not installed (iOS).
fix
For RN <0.60, run `react-native link clevertap-react-native`. For iOS, ensure `cd ios && pod install`. For New Architecture, ensure enabled.
Invariant Violation: `onUserLogin` is not a function
Using an outdated callback pattern from older SDK versions.
fix
Use `CleverTap.onUserLogin({...})` with a profile object. Update SDK to >=3.0.0.
Upgrade
Version history
4.1.0latest on npm
Audit
Dependencies
react-nativerequiredPeer dependency required for the React Native bridge and native modules.
Agent activity
53 hits · last 30 days
node
48
OpenAI (training)
1
Resources
clevertap-react-native — npm install clevertap-react-native · libregistry