{"id":11765,"library":"react-native-converted-in-sdk","title":"React Native ConvertedIn SDK","description":"The `react-native-converted-in-sdk` package provides a React Native bridge for integrating the ConvertedIn tracking and analytics SDKs into both iOS and Android applications. It simplifies the process of incorporating e-commerce event tracking, such as 'view content', 'add to cart', 'initiate checkout', and 'purchase', as well as user identification features. The current stable version is 1.1.0, with a recent history of rapid releases (September 2024) addressing bug fixes and minor feature enhancements, indicating active development. A key differentiator is its dual API approach, offering both a functional `initializeSDK` method and a `RNConvertInSDKProvider` component with a `useConvertedInSdk` hook for flexible integration patterns. The library ships with TypeScript type definitions, improving developer experience. ConvertedIn itself is a marketing operating system for e-commerce, focusing on personalized multi-channel marketing to boost customer engagement and ROI.","status":"active","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/Scode-Njnjas/react-native-converted-in-sdk","tags":["javascript","react-native","ios","android","converted-in","sdk","tracking","events","react-native-converted-in-sdk","typescript"],"install":[{"cmd":"npm install react-native-converted-in-sdk","lang":"bash","label":"npm"},{"cmd":"yarn add react-native-converted-in-sdk","lang":"bash","label":"yarn"},{"cmd":"pnpm add react-native-converted-in-sdk","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for any React Native application.","package":"react","optional":false},{"reason":"Peer dependency as it's a React Native module.","package":"react-native","optional":false}],"imports":[{"note":"Primarily used for manual, root-level SDK initialization without the Provider component. The package ships with TypeScript types, favoring ESM imports.","wrong":"const initializeSDK = require('react-native-converted-in-sdk').initializeSDK;","symbol":"initializeSDK","correct":"import { initializeSDK } from 'react-native-converted-in-sdk';"},{"note":"This is a named export for the context Provider component, not a default export. Used for declarative initialization and providing the SDK context to child components.","wrong":"import RNConvertInSDKProvider from 'react-native-converted-in-sdk';","symbol":"RNConvertInSDKProvider","correct":"import { RNConvertInSDKProvider } from 'react-native-converted-in-sdk';"},{"note":"A React hook designed for convenient access to SDK methods within functional components when using the `RNConvertInSDKProvider`.","symbol":"useConvertedInSdk","correct":"import { useConvertedInSdk } from 'react-native-converted-in-sdk';"},{"note":"One of the core tracking methods for user identification. Can be used directly after `initializeSDK` or via the `useConvertedInSdk` hook.","symbol":"identifyUser","correct":"import { identifyUser } from 'react-native-converted-in-sdk';"}],"quickstart":{"code":"import React, { useEffect } from 'react';\nimport { SafeAreaView, Text, Button, Alert } from 'react-native';\nimport { RNConvertInSDKProvider, useConvertedInSdk } from 'react-native-converted-in-sdk';\n\nconst AppContent = () => {\n  const { initializeSDK, identifyUser, trackEvent, isInitialized } = useConvertedInSdk();\n\n  useEffect(() => {\n    if (!isInitialized) {\n      // This is a redundant call if using RNConvertInSDKProvider, but shows manual initialization if not wrapped\n      initializeSDK({\n        pixelId: process.env.CONVERTEDIN_PIXEL_ID ?? 'CI-YOUR_PIXEL_ID',\n        storeUrl: process.env.CONVERTEDIN_STORE_URL ?? 'https://your-store.com',\n      });\n    }\n    console.log('SDK Initialized:', isInitialized);\n  }, [initializeSDK, isInitialized]);\n\n  const handleIdentifyUser = () => {\n    identifyUser(\"user@example.com\", \"+1\", \"5551234567\");\n    Alert.alert(\"User Identified\", \"Check console for details.\");\n  };\n\n  const handleTrackPurchase = () => {\n    trackEvent(\n      'Purchase',\n      {\n        currency: 'USD',\n        total: 99.99,\n        products: [\n          { id: 'SKU123', quantity: 1, name: 'Sample Product' },\n        ],\n      }\n    );\n    Alert.alert(\"Event Tracked\", \"Purchase event sent.\");\n  };\n\n  return (\n    <SafeAreaView style={{ flex: 1, justifyContent: 'center', alignItems: 'center', gap: 20 }}>\n      <Text style={{ fontSize: 20, fontWeight: 'bold' }}>ConvertedIn SDK Demo</Text>\n      <Button title=\"Identify User\" onPress={handleIdentifyUser} />\n      <Button title=\"Track Purchase Event\" onPress={handleTrackPurchase} />\n      <Text style={{ marginTop: 20 }}>SDK Initialized: {isInitialized ? 'Yes' : 'No'}</Text>\n    </SafeAreaView>\n  );\n};\n\nexport default function App() {\n  return (\n    <RNConvertInSDKProvider\n      pixelId={process.env.CONVERTEDIN_PIXEL_ID ?? 'CI-YOUR_PIXEL_ID'}\n      storeUrl={process.env.CONVERTEDIN_STORE_URL ?? 'https://your-store.com'}\n    >\n      <AppContent />\n    </RNConvertInSDKProvider>\n  );\n}","lang":"typescript","description":"This quickstart demonstrates how to initialize the ConvertedIn SDK using the `RNConvertInSDKProvider` and how to use the `useConvertedInSdk` hook to identify users and track e-commerce events like 'Purchase' within a React Native component. It showcases both provider-based setup and direct method calls."},"warnings":[{"fix":"Upgrade to `react-native-converted-in-sdk@1.0.1` or later: `npm install react-native-converted-in-sdk@latest` or `yarn add react-native-converted-in-sdk@latest`.","message":"Versions prior to `v1.0.1` had known issues causing crashes on iOS. It is strongly recommended to use `v1.0.1` or newer for stable iOS compatibility.","severity":"breaking","affected_versions":"<1.0.1"},{"fix":"Upgrade to `react-native-converted-in-sdk@1.0.2` or later: `npm install react-native-converted-in-sdk@latest` or `yarn add react-native-converted-in-sdk@latest`.","message":"Versions prior to `v1.0.2` had known issues causing crashes on Android, often related to missing native packages or incorrect configuration. Update to `v1.0.2` or later for Android stability.","severity":"breaking","affected_versions":"<1.0.2"},{"fix":"For iOS: Add `pod 'react-native-converted-in-sdk', :path => '../node_modules/react-native-converted-in-sdk'` to your `Podfile` and run `pod install`. For Android: Add `include ':react-native-converted-in-sdk'` and `project(':react-native-converted-in-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-converted-in-sdk/android')` to `settings.gradle`, and `implementation project(':react-native-converted-in-sdk')` to `app/build.gradle`. Then run `./gradlew sync`.","message":"This library requires manual linking steps for both iOS and Android native projects, even with auto-linking in React Native. Ensure you add the Podfile entry for iOS and Gradle configurations for Android as specified in the installation guide.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to `react-native-converted-in-sdk@1.0.2` or later to benefit from included TypeScript definitions: `npm install react-native-converted-in-sdk@latest` or `yarn add react-native-converted-in-sdk@latest`.","message":"Prior to `v1.0.2`, the package lacked proper TypeScript type definitions, leading to potential type errors and a diminished developer experience when using TypeScript. Developers using older versions will miss type inference and autocompletion.","severity":"gotcha","affected_versions":"<1.0.2"},{"fix":"Always ensure the SDK is initialized at the root of your application, or verify initialization status before calling any tracking or identification methods.","message":"Any SDK method call before initialization (either via `initializeSDK` or the `RNConvertInSDKProvider`) will throw an error with the message: \"SDK must be initialized before calling this method\".","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Given past issues, ensure you are on `v1.0.2` or newer, and all native linking steps for both iOS (Podfile) and Android (Gradle) are correctly applied, and run `pod install` (iOS) and `./gradlew sync` (Android).","cause":"This error often indicates an issue with the React Native app's entry point, or a native module crash preventing the JavaScript bundle from loading correctly.","error":"Invariant Violation: 'main' has not been registered. This can happen if:"},{"fix":"Verify that `pod install` was run in your `ios/` directory, and that the `react-native-converted-in-sdk` entry is correctly present in your `Podfile`. Clean your Xcode build folder and rebuild.","cause":"This means the native module `RNConvertedinSdk` was not properly linked or initialized by React Native's bridge, common on iOS if `pod install` was skipped or failed.","error":"TypeError: null is not an object (evaluating 'RNConvertedinSdk.initializeSDK')"},{"fix":"Ensure your `android/settings.gradle` and `android/app/build.gradle` files contain the correct `include` and `implementation` lines as per the installation instructions, and sync your Gradle project (`./gradlew sync`). Also ensure you have `mavenCentral()` or `google()` repositories configured in your `build.gradle` files.","cause":"This Android build error suggests a failure to resolve the underlying native Android SDK dependency, likely due to incorrect Gradle setup or repository access issues.","error":"Could not find com.github.convertedin:android-pixel-sdk:latest. Required by: project :app > project :react-native-converted-in-sdk"},{"fix":"Upgrade to `react-native-converted-in-sdk@1.0.2` or later to get proper type definitions. If already on a recent version, ensure your `tsconfig.json` is correctly configured and your `node_modules` are clean (`rm -rf node_modules && yarn install`).","cause":"This TypeScript error indicates that the TypeScript compiler cannot find the `identifyUser` method (or similar) in the imported module, often due to missing or outdated type definitions.","error":"Property 'identifyUser' does not exist on type 'typeof import(\"react-native-converted-in-sdk\")'"}],"ecosystem":"npm"}