react-native-tiktok-business-configurable
v1.2.3
Published
React native module to integrate TikTok business SDK
Maintainers
Readme
React Native TikTok Business
Fork of https://github.com/adblanc/react-native-tiktok-business. Has additional config params. TikTok Business SDK for React Native. In debug mode, events should appear in the "Test Event" tab.
Installation
npm install react-native-tiktok-business-configurable
yarn add react-native-tiktok-business-configurable
bun add react-native-tiktok-business-configurableExpo config plugin:
For Expo apps, you'll need to add both the plugin configuration and the required iOS privacy permission:
{
"expo": {
"plugins": [
[
"react-native-tiktok-business-configurable",
{
"ios": {
"appId": "YOUR_APP_ID",
"tiktokAppId": "YOUR_TIKTOK_APP_ID",
"disableAutomaticTracking": true,
"disablePaymentTracking": true,
"delayATTSeconds": 5,
"logLevel": "error",
"disableAppTrackingDialog": true
},
"android": {
"appId": "YOUR_APP_ID",
"tiktokAppId": "YOUR_TIKTOK_APP_ID"
}
}
]
],
"ios": {
"infoPlist": {
"NSUserTrackingUsageDescription": "This identifier will be used to provide a more personalized experience for you."
}
}
}
}The NSUserTrackingUsageDescription is required for iOS devices to request tracking authorization. Without this permission string, the tracking dialog will not be shown to users.
Usage
import TiktokBusiness from "react-native-tiktok-business-configurable";
// Identify a user
TiktokBusiness.identify("user-external-id", "username", "phone", "email");
// Clear user identification
TiktokBusiness.logout();
// Request tracking authorization (iOS only)
const status = await TiktokBusiness.requestTrackingAuthorization();
// Check if debug mode is enabled
const isDebug = TiktokBusiness.isDebugMode();
// Manually flush events (iOS only)
TiktokBusiness.flush();
// Track a simple event
TiktokBusiness.trackEvent("purchase");
// Track event with custom data
TiktokBusiness.trackEvent("purchase_completed", "order-123", [
{ key: "currency", value: "USD" },
{ key: "value", value: "99.99" },
{ key: "quantity", value: "1" },
{ key: "price", value: "99.99" },
]);