Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
react-native-converted-in-sdk
Advanced tools
A React Native SDK for ConvertedIn, providing easy integration of ConvertedIn's tracking and analytics features into your React Native application.
iOS | Android |
---|---|
Install the package using npm:
npm install react-native-converted-in-sdk
Or with yarn:
yarn add react-native-converted-in-sdk
Add ConvertedinMobileSDK
to your Podfile
:
pod 'react-native-converted-in-sdk', :path => '../node_modules/react-native-converted-in-sdk'
Run pod install
inside the ios
directory.
Add the following line to the android/settings.gradle
file:
include ':react-native-converted-in-sdk'
project(':react-native-converted-in-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-converted-in-sdk/android')
Add the following line to the android/app/build.gradle
file:
implementation project(':react-native-converted-in-sdk')
Sync your project with Gradle files by running:
./gradlew sync
Import the module and initialize it in the root of your app:
import { initializeSDK } from 'react-native-converted-in-sdk';
initializeSDK({
pixelId: 'your_pixel_id',
storeUrl: 'your_store_url',
});
Use the SDK methods in your components:
import { identifyUser } from 'react-native-converted-in-sdk';
const Component = () => {
React.useEffect(() => {
// Example usage of SDK functions
identifyUser("test@test.com", "+91", "9876543210");
}, []);
// Your component logic here
};
Wrap your app with RNConvertInSDKProvider
:
export default function App() {
return (
<RNConvertInSDKProvider
pixelId="your_pixel_id"
storeUrl="your_store_url"
>
<AppContent />
</RNConvertInSDKProvider>
);
}
Use the useConvertedInSdk
hook in your components:
import { useConvertedInSdk } from 'react-native-converted-in-sdk';
const Component = () => {
const { identifyUser } = useConvertedInSdk();
React.useEffect(() => {
// Example usage of SDK functions
identifyUser("test@test.com", "+91", "9876543210");
}, []);
// Your component logic here
};
RNConvertInSDKProvider
Prop | Type | Required | Description |
---|---|---|---|
pixelId | string | Yes | Your ConvertedIn pixel ID |
storeUrl | string | Yes | Your store URL |
useConvertedInSdk
Returns an object with the following methods:
Method | Parameters | Return Type | Description |
---|---|---|---|
isInitialized | None | boolean | Returns whether the SDK has been initialized. |
initializeSDK | config: { pixelId: string, storeUrl: string } | Promise<void> | Initializes the SDK with the provided configuration. Call this as early as possible in your app's lifecycle. |
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. |
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. |
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. |
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. |
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. |
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. |
registerEvent | None | void | Tracks a user registration event. This should be called when a new user creates an account in your app. |
Product
InterfaceProperty | Type | Description |
---|---|---|
id | number | The unique identifier of the product. |
quantity | number | The quantity of the product. |
name | string | The name of the product. |
Check the example
folder for a complete implementation example.
[!NOTE] If you encounter an error while installing pods in
example/ios
, please refer to this solution: https://stackoverflow.com/a/78874710/12355129
To develop the SDK locally:
Clone the repository.
Ensure you have the following environment set up:
Install dependencies:
yarn install
Run the example app:
iOS:
cd example/ios && pod install && cd ../..
yarn example ios
Android:
yarn example android
Run tests with:
yarn test
If any SDK method is called before initialization, an error will be thrown with the message:
SDK must be initialized before calling this method.
Make sure to initialize the SDK using the initializeSDK
method before invoking any other SDK methods.
See the contributing guide to learn how to contribute to the repository and the development workflow.
For detailed information and advanced usage, refer to the official ConvertedIn SDK documentation:
MIT
FAQs
Converted In SDK for React Native
The npm package react-native-converted-in-sdk receives a total of 6,880 weekly downloads. As such, react-native-converted-in-sdk popularity was classified as popular.
We found that react-native-converted-in-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.