{"id":22026065,"url":"https://github.com/scode-njnjas/react-native-converted-in-sdk","last_synced_at":"2025-05-07T10:15:36.251Z","repository":{"id":253726418,"uuid":"844334754","full_name":"Scode-Njnjas/react-native-converted-in-sdk","owner":"Scode-Njnjas","description":"A React Native SDK for ConvertedIn, providing easy integration of ConvertedIn's tracking and analytics features into your React Native application.","archived":false,"fork":false,"pushed_at":"2024-09-09T04:58:18.000Z","size":2936,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T10:15:15.885Z","etag":null,"topics":["android","android-pixel-sdk","com-github-convertedin","converted-in","convertedinmobilesdk","events","ios","react-native","sdk","sdk-react-native","tracking"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-native-converted-in-sdk","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Scode-Njnjas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-19T03:25:34.000Z","updated_at":"2025-01-15T03:26:57.000Z","dependencies_parsed_at":"2024-11-30T07:25:42.348Z","dependency_job_id":"3d8abe75-1743-4d26-a7d4-b5386c1d89cb","html_url":"https://github.com/Scode-Njnjas/react-native-converted-in-sdk","commit_stats":null,"previous_names":["scode-njnjas/react-native-convert-in-sdk","scode-njnjas/react-native-converted-in-sdk"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Scode-Njnjas%2Freact-native-converted-in-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Scode-Njnjas%2Freact-native-converted-in-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Scode-Njnjas%2Freact-native-converted-in-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Scode-Njnjas%2Freact-native-converted-in-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Scode-Njnjas","download_url":"https://codeload.github.com/Scode-Njnjas/react-native-converted-in-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252856558,"owners_count":21814858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-pixel-sdk","com-github-convertedin","converted-in","convertedinmobilesdk","events","ios","react-native","sdk","sdk-react-native","tracking"],"created_at":"2024-11-30T07:25:03.807Z","updated_at":"2025-05-07T10:15:36.225Z","avatar_url":"https://github.com/Scode-Njnjas.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-converted-in-sdk\n\nA React Native SDK for ConvertedIn, providing easy integration of ConvertedIn's tracking and analytics features into your React Native application.\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/react-native-converted-in-sdk.svg)](https://badge.fury.io/js/react-native-converted-in-sdk) [![Downloads](https://img.shields.io/npm/dm/react-native-converted-in-sdk.svg)](https://www.npmjs.com/package/react-native-converted-in-sdk)\n\n## 📹 Demo\n\n| iOS                                                                                          | Android                                                                                          |\n| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |\n| ![iOS Demo](https://github.com/user-attachments/assets/15ff28dd-5039-4332-8e4a-5617bd4b4c66) | ![Android Demo](https://github.com/user-attachments/assets/0ac36fc9-729b-4b17-812b-803b4d2bdfbd) |\n\n## 🛠️ Requirements\n\n- iOS 13.0 or higher\n- Android 5.0 (API level 21) or higher\n\n## 📦 Installation\n\nInstall the package using npm:\n\n```bash\nnpm install react-native-converted-in-sdk\n```\n\nOr with yarn:\n\n```bash\nyarn add react-native-converted-in-sdk\n```\n\n### Follow these steps to complete the installation:\n\n#### iOS\n\n- Add `ConvertedinMobileSDK` to your `Podfile`:\n\n  ```ruby\n  pod 'react-native-converted-in-sdk', :path =\u003e '../node_modules/react-native-converted-in-sdk'\n  ```\n\n- Run `pod install` inside the `ios` directory.\n\n#### Android\n\n- Add the following line to the `android/settings.gradle` file:\n\n  ```gradle\n  include ':react-native-converted-in-sdk'\n  project(':react-native-converted-in-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-converted-in-sdk/android')\n  ```\n\n- Add the following line to the `android/app/build.gradle` file:\n\n  ```gradle\n  implementation project(':react-native-converted-in-sdk')\n  ```\n\n- Sync your project with Gradle files by running:\n\n  ```bash\n  ./gradlew sync\n  ```\n\n## 🚀 Usage\n\n### Manual Module Usage\n\n1. **Import the module and initialize it in the root of your app:**\n\n   ```jsx\n   import { initializeSDK } from 'react-native-converted-in-sdk';\n\n   initializeSDK({\n     pixelId: 'your_pixel_id',\n     storeUrl: 'your_store_url',\n   });\n   ```\n\n2. **Use the SDK methods in your components:**\n\n   ```jsx\n   import { identifyUser } from 'react-native-converted-in-sdk';\n\n   const Component = () =\u003e {\n     React.useEffect(() =\u003e {\n       // Example usage of SDK functions\n       identifyUser(\"test@test.com\", \"+91\", \"9876543210\");\n     }, []);\n\n     // Your component logic here\n   };\n   ```\n\n### Usage with Hook\n\n1. **Wrap your app with `RNConvertInSDKProvider`:**\n\n    ```jsx\n    export default function App() {\n      return (\n        \u003cRNConvertInSDKProvider\n          pixelId=\"your_pixel_id\"\n          storeUrl=\"your_store_url\"\n        \u003e\n          \u003cAppContent /\u003e\n        \u003c/RNConvertInSDKProvider\u003e\n      );\n    }\n    ```\n\n2. **Use the `useConvertedInSdk` hook in your components:**\n\n    ```jsx\n    import { useConvertedInSdk } from 'react-native-converted-in-sdk';\n\n    const Component = () =\u003e {\n      const { identifyUser } = useConvertedInSdk();\n\n      React.useEffect(() =\u003e {\n        // Example usage of SDK functions\n        identifyUser(\"test@test.com\", \"+91\", \"9876543210\");\n      }, []);\n\n      // Your component logic here\n    };\n    ```\n\n## 📚 API Reference\n\n### `RNConvertInSDKProvider`\n\n| Prop       | Type   | Required | Description               |\n| ---------- | ------ | -------- | ------------------------- |\n| `pixelId`  | string | Yes      | Your ConvertedIn pixel ID |\n| `storeUrl` | string | Yes      | Your store URL            |\n\n### `useConvertedInSdk`\n\nReturns an object with the following methods:\n\n| Method                  | Parameters                                                                | Return Type     | Description                                                                                                                                         |\n| ----------------------- | ------------------------------------------------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `isInitialized`         | None                                                                      | `boolean`       | Returns whether the SDK has been initialized.                                                                                                       |\n| `initializeSDK`         | `config: { pixelId: string, storeUrl: string }`                           | `Promise\u003cvoid\u003e` | Initializes the SDK with the provided configuration. Call this as early as possible in your app's lifecycle.                                        |\n| `identifyUser`          | `email: string, countryCode: string, phoneNumber: string`                 | `void`          | Identifies a user with their email, country code, and phone number. This helps in tracking user-specific events and improving personalization.      |\n| `addEvent`              | `eventName: string, currency: string, total: number, products: Product[]` | `void`          | Adds a custom event with the specified name, currency, total, and products. This allows tracking specific actions or milestones in your app.        |\n| `viewContentEvent`      | `currency: string, total: number, products: Product[]`                    | `void`          | Tracks a view content event when a user views a product or content page. Includes details like currency, total value, and viewed products.          |\n| `addToCartEvent`        | `currency: string, total: number, products: Product[]`                    | `void`          | Tracks an add-to-cart event when a user adds items to their shopping cart. Includes details about the added products, total value, and currency.    |\n| `initiateCheckoutEvent` | `currency: string, total: number, products: Product[]`                    | `void`          | Tracks the initiation of the checkout process. This event should be called when a user starts the purchasing process.                               |\n| `purchaseEvent`         | `currency: string, total: number, products: Product[]`                    | `void`          | Tracks a completed purchase event. This should be called when a user successfully completes a transaction, including details of purchased products. |\n| `registerEvent`         | None                                                                      | `void`          | Tracks a user registration event. This should be called when a new user creates an account in your app.                                             |\n\n### `Product` Interface\n\n| Property   | Type   | Description                           |\n| ---------- | ------ | ------------------------------------- |\n| `id`       | number | The unique identifier of the product. |\n| `quantity` | number | The quantity of the product.          |\n| `name`     | string | The name of the product.              |\n\n## 🧪 Sample App\n\nCheck the `example` folder for a complete implementation example.\n\n\u003e [!NOTE]\n\u003e If you encounter an error while installing pods in `example/ios`, please refer to this solution: [https://stackoverflow.com/a/78874710/12355129](https://stackoverflow.com/a/78874710/12355129)\n\n## 🛠️ Development\n\nTo develop the SDK locally:\n\n1. Clone the repository.\n2. Ensure you have the following environment set up:\n   - Node.js version 18 or higher.\n   - Yarn version 3 or higher (project version: 3.6.1).\n   - Java 17 or higher.\n   - For iOS development: Xcode 12.0 or higher. iOS deployment target 13.0 or higher.\n   - For Android development: Android Studio 4.0 or higher.\n\n3. Install dependencies:\n\n   ```bash\n   yarn install\n   ```\n\n4. Run the example app:\n\n   - iOS:\n\n     ```bash\n     cd example/ios \u0026\u0026 pod install \u0026\u0026 cd ../..\n     yarn example ios\n     ```\n\n   - Android:\n\n     ```bash\n     yarn example android\n     ```\n\n## 🧪 Testing\n\nRun tests with:\n\n```bash\nyarn test\n```\n\n## 🚨 Error Handling\n\nIf any SDK method is called before initialization, an error will be thrown with the message:\n\n```txt\nSDK must be initialized before calling this method.\n```\n\nMake sure to initialize the SDK using the `initializeSDK` method before invoking any other SDK methods.\n\n## 🤝 Contributing\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n## 📚 Official Documentation\n\nFor detailed information and advanced usage, refer to the official ConvertedIn SDK documentation:\n\n- [Android Getting Started Guide](https://developer.converted.in/android/getting-started)\n- [iOS Getting Started Guide](https://developer.converted.in/ios/getting-started)\n\n## 📜 License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscode-njnjas%2Freact-native-converted-in-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscode-njnjas%2Freact-native-converted-in-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscode-njnjas%2Freact-native-converted-in-sdk/lists"}