React Native SDK - Methods Reference
This comprehensive reference documents all available methods in the Singular SDK for React Native applications. The SDK provides functionality for initialization, event tracking, revenue reporting, attribution, data privacy compliance, and configuration. Each method is presented with a description, signature, and practical usage examples to help developers integrate Singular's SDK capabilities into their React Native applications.
adRevenue
Singular.adRevenue Method
Tracks ad revenue events with detailed ad data information. This method allows you to report revenue generated from ads displayed in your application with various parameters to categorize and analyze the ad performance.
Signature
static adRevenue(adData: {
ad_platform: string;
ad_currency: string;
ad_revenue: number;
[key: string]: any;
}): void
Required Properties
-
ad_platform(string): The advertising platform from which the ad revenue is generated (e.g., 'AdMob', 'Facebook', 'UnityAds'). -
ad_currency(string): The currency code (ISO 4217 format) in which the ad revenue is reported (e.g., 'USD', 'EUR'). -
ad_revenue(number): The amount of revenue generated from the ad impression.
Optional Properties
-
ad_unit_id(string): The unique identifier for the ad unit where the ad was displayed. -
ad_type(string): The type or format of the ad (e.g., 'Rewarded', 'Interstitial', 'Banner'). -
ad_placement_name(string): The name or location identifier for where the ad was placed within your application (e.g., 'level_complete', 'main_menu'). -
ad_mediation_platform(string): The ad mediation platform used to serve the ad (e.g., 'admob', 'ironsource', 'max'). -
ad_impression_id(string): A unique identifier for the specific ad impression event. -
ad_group_type(string): The type or category classification of the ad group. -
ad_unit_name(string): The human-readable name assigned to the ad unit. -
ad_group_id(string): The unique identifier for the ad group associated with this impression. -
ad_group_name(string): The human-readable name of the ad group. -
ad_group_priority(number): The numeric priority level assigned to the ad group for mediation waterfall ordering. -
ad_precision(string): The precision or accuracy level of the ad revenue data (e.g., 'estimated', 'precise', 'publisher_defined'). -
ad_placement_id(string): The unique identifier for the ad placement location within your application.
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
const adData = {
ad_platform: 'AdMob',
ad_currency: 'USD',
ad_revenue: 0.05,
ad_unit_id: 'ca-app-pub-1234567890123456',
ad_type: 'Rewarded',
ad_placement_name: 'level_complete'
};
NativeSingular.adRevenue(adData);
import { Singular } from 'singular-react-native';
// Track ad revenue event
const adData = {
ad_platform: 'AdMob',
ad_currency: 'USD',
ad_revenue: 0.05,
ad_unit_id: 'ca-app-pub-1234567890123456',
ad_type: 'Rewarded',
ad_placement_name: 'level_complete'
};
Singular.adRevenue(adData);
clearGlobalProperties
Singular.clearGlobalProperties Method
Removes all previously set global properties. This is useful when you need to reset the global properties, for example when a user logs out of your application.
Signature
static clearGlobalProperties(): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Clear all global properties
NativeSingular.clearGlobalProperties();
import { Singular } from 'singular-react-native';
// Clear all global properties
Singular.clearGlobalProperties();
createReferrerShortLink
Singular.createReferrerShortLink Method
Creates a short link with referrer information that can be used for sharing and attribution. This method generates trackable links that can be shared with users, allowing you to attribute installs and activities to specific referral sources.
Signature
static createReferrerShortLink(
baseLink: string,
referrerName: string,
referrerId: string,
passthroughParams: Record<string, any>,
completionHandler: (data: string | null, error?: string) => void
): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Create a short link for referral
NativeSingular.createReferrerShortLink(
'https://sample.sng.link/B4tbmv8fp',
'John Doe',
'aq239897',
{ channel: 'sms', campaign: 'summer_promo' },
(result: string, error: string) => {
if (error) {
console.error('Short link creation failed:', error);
} else {
console.log('Short link created successfully:', result);
}
}
);
import { Singular } from 'singular-react-native';
// Create a short link for referral
Singular.createReferrerShortLink(
'https://sample.sng.link/B4tbmv8fp',
'John Doe',
'aq239897',
{ channel: 'sms', campaign: 'summer_promo' },
(link, error) => {
if (error) {
console.error('Error creating short link:', error);
} else if (link) {
console.log('Generated short link:', link);
// Share the link with users
}
}
);
customRevenue
Singular.customRevenue Method
Tracks custom revenue events with a specified event name, currency, and amount. This allows for more specific revenue tracking with custom event names.
Signature
static customRevenue(
eventName: string,
currency: string,
amount: number
): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Track a custom revenue event
NativeSingular.customRevenue('premium_subscription', 'USD', 9.99);
import { Singular } from 'singular-react-native';
// Track a custom revenue event
Singular.customRevenue('premium_subscription', 'USD', 9.99);
customRevenueWithArgs
Singular.customRevenueWithArgs Method
Tracks custom revenue events with a specified event name, currency, amount, and additional attributes. This allows for more detailed revenue tracking with custom parameters.
Signature
static customRevenueWithArgs(
eventName: string,
currency: string,
amount: number,
args: Record<string, any>
): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Track a custom revenue event with attributes
NativeSingular.customRevenueWithArgs(
'in_app_purchase',
'USD',
5.99,
{
product_id: 'com.app.gems_pack_small',
quantity: 1
}
);
import { Singular } from 'singular-react-native';
// Track a custom revenue event with attributes
Singular.customRevenueWithArgs(
'in_app_purchase',
'USD',
5.99,
{
product_id: 'com.app.gems_pack_small',
quantity: 1
}
);
event
Singular.event Method
Tracks events with the specified name. Use this method to track user actions and engagement within your application.
Signature
static event(eventName: string): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Track a simple event
NativeSingular.event('level_completed');
import { Singular } from 'singular-react-native';
// Track a simple event
Singular.event('level_completed');
eventWithArgs
Singular.eventWithArgs Method
Tracks events with the specified name and additional custom attributes. Use this method to track user actions with detailed parameters.
Signature
static eventWithArgs(
eventName: string,
args: Record<string, any>
): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Track an event with additional parameters
NativeSingular.eventWithArgs('level_completed', {
level_id: 5,
score: 12500,
time_spent: 120,
difficulty: 'medium'
});
import { Singular } from 'singular-react-native';
// Track an event with additional parameters
Singular.eventWithArgs('level_completed', {
level_id: 5,
score: 12500,
time_spent: 120,
difficulty: 'medium'
});
getGlobalProperties
Singular.getGlobalProperties Method
Retrieves all currently set global properties. This method returns a promise that resolves to an object containing all global properties that have been set for the SDK.
Signature
static getGlobalProperties(): Promise<Record<string, any>>
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Get all global properties
NativeSingular.getGlobalProperties();
import { Singular } from 'singular-react-native';
// Get all global properties
Singular.getGlobalProperties();
getLimitDataSharing
Singular.getLimitDataSharing Method
Retrieves the current data sharing limitation status. This method returns a promise that resolves to a boolean indicating whether data sharing is currently limited.
Signature
static getLimitDataSharing(): Promise<boolean>
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Check if data sharing is limited
NativeSingular.getLimitDataSharing();
import { Singular } from 'singular-react-native';
// Check if data sharing is limited
Singular.getLimitDataSharing();
handlePushNotification
Singular.handlePushNotification Method
Processes a push notification payload for attribution. This method should be called when your app receives a push notification to allow Singular to attribute it correctly. This method is iOS-only.
Signature
static handlePushNotification(
pushNotificationPayload: Record<string, any>
): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
import { Platform } from 'react-native';
// Handle a received push notification (iOS only)
if (Platform.OS === 'ios') {
const userInfo = remoteMessage.data;
NativeSingular.handlePushNotification(userInfo);
}
import { Singular } from 'singular-react-native';
import { Platform } from 'react-native';
// Handle a received push notification (iOS only)
if (Platform.OS === 'ios') {
const userInfo = remoteMessage.data;
Singular.handlePushNotification(userInfo);
}
inAppPurchase
Singular.inAppPurchase Method
Reports revenue to Singular and performs receipt validation (if enabled) on the backend. The purchase object should be of SingularIOSPurchase or SingularAndroidPurchase type.
Signature
static inAppPurchase(
eventName: string,
purchase: SingularIOSPurchase | SingularAndroidPurchase
): void
SingularIOSPurchase Purchase Class Constructors
constructor(
revenue: number,
currency: string,
productId: string,
transactionId: string,
receipt: string
)
SingularAndroidPurchase Purchase Class Constructors
constructor(
revenue: number,
currency: string,
receipt: string,
signature: string
)
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
import { SingularIOSPurchase, SingularAndroidPurchase } from 'singular-react-native';
import { Platform } from 'react-native';
// iOS Example
if (Platform.OS === 'ios') {
const iosPurchase = new SingularIOSPurchase(
99.99, // revenue
'USD', // currency
'premium_bundle', // productId
'trans_12345', // transactionId
'base64receipt...' // receipt
);
// Convert to plain object for TurboModule
NativeSingular.inAppPurchase('purchase', iosPurchase.toSpecObject());
}
// Android Example
if (Platform.OS === 'android') {
const androidPurchase = new SingularAndroidPurchase(
99.99, // revenue
'USD', // currency
'purchaseDataJSON', // receipt
'signatureString' // signature
);
// Convert to plain object for TurboModule
NativeSingular.inAppPurchase('purchase', androidPurchase.toSpecObject());
}
import { Singular, SingularIOSPurchase, SingularAndroidPurchase } from 'singular-react-native';
import { Platform } from 'react-native';
// iOS Example
if (Platform.OS === 'ios') {
const iosPurchase = new SingularIOSPurchase(
99.99, // revenue
'USD', // currency
'premium_bundle', // productId
'trans_12345', // transactionId
'base64receipt...' // receipt
);
Singular.inAppPurchase('purchase', iosPurchase);
}
// Android Example
if (Platform.OS === 'android') {
const androidPurchase = new SingularAndroidPurchase(
99.99, // revenue
'USD', // currency
'purchaseDataJSON', // receipt
'signatureString' // signature
);
Singular.inAppPurchase('purchase', androidPurchase);
}
inAppPurchaseWithArgs
Singular.inAppPurchaseWithArgs Method
Reports revenue to Singular with additional attributes and performs receipt validation (if enabled) on the backend. The purchase object should be of SingularIOSPurchase or SingularAndroidPurchase type.
Signature
static inAppPurchaseWithArgs(
eventName: string,
purchase: SingularIOSPurchase | SingularAndroidPurchase,
args: Record<string, any>
): void
SingularIOSPurchase Purchase Class Constructors
constructor(
revenue: number,
currency: string,
productId: string,
transactionId: string,
receipt: string
)
SingularAndroidPurchase Purchase Class Constructors
constructor(
revenue: number,
currency: string,
receipt: string,
signature: string
)
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
import { SingularIOSPurchase, SingularAndroidPurchase } from 'singular-react-native';
import { Platform } from 'react-native';
// iOS Example - Track IAP with additional attributes
if (Platform.OS === 'ios') {
const iosPurchase = new SingularIOSPurchase(
99.99, // revenue
'USD', // currency
'premium_bundle', // productId
'trans_12345', // transactionId
'base64receipt...' // receipt
);
// Convert to plain object for TurboModule
NativeSingular.inAppPurchaseWithArgs(
'purchase',
iosPurchase.toSpecObject(),
{
product_category: 'premium_content',
is_first_purchase: true,
user_tier: 'gold'
}
);
}
// Android Example - Track IAP with additional attributes
if (Platform.OS === 'android') {
const androidPurchase = new SingularAndroidPurchase(
99.99, // revenue
'USD', // currency
'purchaseDataJSON', // receipt
'signatureString' // signature
);
// Convert to plain object for TurboModule
NativeSingular.inAppPurchaseWithArgs(
'purchase',
androidPurchase.toSpecObject(),
{
product_category: 'premium_content',
is_first_purchase: true,
user_tier: 'gold'
}
);
}
import { Singular, SingularIOSPurchase, SingularAndroidPurchase } from 'singular-react-native';
import { Platform } from 'react-native';
// iOS Example - Track IAP with additional attributes
if (Platform.OS === 'ios') {
const iosPurchase = new SingularIOSPurchase(
99.99, // revenue
'USD', // currency
'premium_bundle', // productId
'trans_12345', // transactionId
'base64receipt...' // receipt
);
Singular.inAppPurchaseWithArgs('purchase', iosPurchase, {
product_category: 'premium_content',
is_first_purchase: true,
user_tier: 'gold'
});
}
// Android Example - Track IAP with additional attributes
if (Platform.OS === 'android') {
const androidPurchase = new SingularAndroidPurchase(
99.99, // revenue
'USD', // currency
'purchaseDataJSON', // receipt
'signatureString' // signature
);
Singular.inAppPurchaseWithArgs('purchase', androidPurchase, {
product_category: 'premium_content',
is_first_purchase: true,
user_tier: 'gold'
});
}
init
Singular.init Method
Initializes the Singular SDK with the provided configuration. This is the first method you should call to start using the Singular SDK.
Signature
static init(singularConfig: SingularConfig): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Create configuration object
const config: SingularConfig = {
apikey: 'YOUR_API_KEY',
secret: 'YOUR_SECRET',
customUserId: 'user-123456',
sessionTimeout: 60,
enableLogging: true,
logLevel: 3,
}
// Initialize the SDK
NativeSingular.init(config);
import { Singular, SingularConfig } from 'singular-react-native';
// Create configuration object
const config = new SingularConfig('YOUR_API_KEY', 'YOUR_SECRET');
// Configure additional options if needed
config.customUserId = 'user-123456';
config.sessionTimeout = 60;
config.enableLogging = true;
config.logLevel = 3;
// Initialize the SDK
Singular.init(config);
isAllTrackingStopped
Singular.isAllTrackingStopped Method
Checks if all tracking is currently stopped. This method returns a promise that resolves to a boolean indicating whether tracking is currently stopped.
Signature
static isAllTrackingStopped(): Promise<boolean>
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Check if tracking is stopped
NativeSingular.isAllTrackingStopped();
import { Singular } from 'singular-react-native';
// Check if tracking is stopped
Singular.isAllTrackingStopped();
limitDataSharing
Singular.limitDataSharing Method
Sets the data sharing limitation status. Use this method to limit data sharing based on user consent or privacy requirements.
Signature
static limitDataSharing(limitDataSharingValue: boolean): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// To limit data sharing (e.g., when user opts out)
NativeSingular.limitDataSharing(true);
// To enable full data sharing (e.g., when user opts in)
NativeSingular.limitDataSharing(false);
import { Singular } from 'singular-react-native';
// To limit data sharing (e.g., when user opts out)
Singular.limitDataSharing(true);
// To enable full data sharing (e.g., when user opts in)
Singular.limitDataSharing(false);
resumeAllTracking
Singular.resumeAllTracking Method
Resumes all tracking activities that were previously stopped. Use this method to re-enable tracking after it has been stopped.
Signature
static resumeAllTracking(): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Resume tracking when user opts back in
NativeSingular.resumeAllTracking();
import { Singular } from 'singular-react-native';
// Resume tracking when user opts back in
Singular.resumeAllTracking();
revenue
Singular.revenue Method
Tracks revenue events with currency and amount. This allows basic revenue tracking for your application.
Signature
static revenue(currency: string, amount: number): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Track revenue with currency and amount
NativeSingular.revenue('USD', 9.99);
import { Singular } from 'singular-react-native';
// Track revenue with currency and amount
Singular.revenue('USD', 9.99);
revenueWithArgs
Singular.revenueWithArgs Method
Tracks revenue events with currency, amount, and additional attributes. This allows comprehensive revenue tracking with custom parameters.
Signature
static revenueWithArgs(
currency: string,
amount: number,
args: Record<string, any>
): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Track revenue with additional attributes
NativeSingular.revenueWithArgs('USD', 19.98, {
product_id: 'premium_gems',
quantity: 2
});
import { Singular } from 'singular-react-native';
// Track revenue with additional attributes
Singular.revenueWithArgs('USD', 19.98, {
product_id: 'premium_gems',
quantity: 2
});
setCustomUserId
Singular.setCustomUserId Method
Sets a custom user ID for the current user. This allows you to associate Singular data with your own user identification system.
Signature
static setCustomUserId(customUserId: string): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Set custom user ID after user logs in
NativeSingular.setCustomUserId('user123456');
import { Singular } from 'singular-react-native';
// Set custom user ID after user logs in
Singular.setCustomUserId('user123456');
setDeviceCustomUserId
This method is depricated and no longer used.
Singular.setDeviceCustomUserId Method
Sets a custom user ID at the device level. This allows you to associate Singular data with your own user identification system at the device level.
Signature
static setDeviceCustomUserId(customUserId: string): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Set device-level custom user ID
NativeSingular.setDeviceCustomUserId('device_user_123456');
import { Singular } from 'singular-react-native';
// Set device-level custom user ID
Singular.setDeviceCustomUserId('device_user_123456');
setGlobalProperty
Singular.setGlobalProperty Method
Sets a global property that will be sent with all events. This allows you to add consistent attributes to all events without specifying them each time.
Signature
static setGlobalProperty(
key: string,
value: string,
overrideExisting: boolean
): Promise<boolean>
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Set a global property
NativeSingular.setGlobalProperty(
'user_tier',
'premium',
true
);
import { Singular } from 'singular-react-native';
// Set a global property
Singular.setGlobalProperty(
'user_tier',
'premium',
true
);
setLimitAdvertisingIdentifiers
Singular.setLimitAdvertisingIdentifiers Method
Enables or disables limited advertising identifiers mode. This option affects how the SDK collects and uses device identifiers for tracking.
Signature
static setLimitAdvertisingIdentifiers(enabled: boolean): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Enable limited identifiers mode
NativeSingular.setLimitAdvertisingIdentifiers(true);
// Disable limited identifiers mode
NativeSingular.setLimitAdvertisingIdentifiers(false);
import { Singular } from 'singular-react-native';
// Enable limited identifiers mode
Singular.setLimitAdvertisingIdentifiers(true);
// Disable limited identifiers mode
Singular.setLimitAdvertisingIdentifiers(false);
setUninstallToken
Singular.setUninstallToken Method
Registers the push notification token for uninstall tracking. This method should be called with the push notification token to enable uninstall tracking.
Signature
static setUninstallToken(token: string): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
import messaging from '@react-native-firebase/messaging';
// Register device token for uninstall tracking
NativeSingular.setUninstallToken(token);
import { Singular } from 'singular-react-native';
import messaging from '@react-native-firebase/messaging';
// Register device token for uninstall tracking
Singular.setUninstallToken(token);
skanGetConversionValue
Singular.skanGetConversionValue Method
Retrieves the current SKAdNetwork conversion value. This method returns a promise that resolves to the current conversion value used for SKAdNetwork attribution. This method is iOS-only.
Signature
static skanGetConversionValue(): Promise<number | null>
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
import { Platform } from 'react-native';
// Get the current SKAdNetwork conversion value (iOS only)
if (Platform.OS === 'ios') {
const conversionValue = await NativeSingular.skanGetConversionValue();
console.log('Current conversion value:', conversionValue ?? 0);
}
import { Singular } from 'singular-react-native';
import { Platform } from 'react-native';
// Get the current SKAdNetwork conversion value (iOS only)
if (Platform.OS === 'ios') {
const conversionValue = await Singular.skanGetConversionValue();
console.log('Current conversion value:', conversionValue ?? 0);
}
skanRegisterAppForAdNetworkAttribution
Singular.skanRegisterAppForAdNetworkAttribution Method
Registers the app for SKAdNetwork attribution. This method should be called to enable SKAdNetwork attribution on iOS. This method is iOS-only.
Signature
static skanRegisterAppForAdNetworkAttribution(): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
import { Platform } from 'react-native';
// Register for SKAdNetwork attribution (iOS only)
if (Platform.OS === 'ios') {
NativeSingular.skanRegisterAppForAdNetworkAttribution();
}
import { Singular } from 'singular-react-native';
import { Platform } from 'react-native';
// Register for SKAdNetwork attribution (iOS only)
if (Platform.OS === 'ios') {
Singular.skanRegisterAppForAdNetworkAttribution();
}
skanUpdateConversionValue
Singular.skanUpdateConversionValue Method
Updates the SKAdNetwork conversion value. This method allows you to manually update the conversion value used for SKAdNetwork attribution. This method is iOS-only.
Signature
static skanUpdateConversionValue(conversionValue: number): Promise<boolean>
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
import { Platform } from 'react-native';
// Update the SKAdNetwork conversion value (iOS only)
if (Platform.OS === 'ios') {
const success = await NativeSingular.skanUpdateConversionValue(5);
if (success) {
console.log('Conversion value updated successfully');
}
}
import { Singular } from 'singular-react-native';
import { Platform } from 'react-native';
// Update the SKAdNetwork conversion value (iOS only)
if (Platform.OS === 'ios') {
const success: boolean = await Singular.skanUpdateConversionValue(5);
if (success) {
console.log('Conversion value updated successfully');
}
}
skanUpdateConversionValues
Singular.skanUpdateConversionValues Method
Updates SKAdNetwork 4.0 conversion values with fine value, coarse value, and lock parameters. This method is for iOS 16.1+ and is iOS-only.
Signature
static skanUpdateConversionValues(
conversionValue: number,
coarse: number,
lock: boolean
): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
import { Platform } from 'react-native';
// Update SKAdNetwork 4.0 conversion values (iOS 16.1+)
if (Platform.OS === 'ios') {
NativeSingular.skanUpdateConversionValues(
5, // fine value (0-63)
1, // coarse value (0=low, 1=medium, 2=high)
false // lock
);
}
import { Singular } from 'singular-react-native';
import { Platform } from 'react-native';
// Update SKAdNetwork 4.0 conversion values (iOS 16.1+)
if (Platform.OS === 'ios') {
Singular.skanUpdateConversionValues(
5, // fine value (0-63)
1, // coarse value (0=low, 1=medium, 2=high)
false // lock
);
}
stopAllTracking
Singular.stopAllTracking Method
Stops all tracking activities. Use this method to disable tracking when users opt out or for privacy compliance.
Signature
static stopAllTracking(): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Stop tracking when user opts out
NativeSingular.stopAllTracking();
import { Singular } from 'singular-react-native';
// Stop tracking when user opts out
Singular.stopAllTracking();
trackingOptIn
Singular.trackingOptIn Method
Indicates that the user has opted in to tracking. Call this method when the user explicitly consents to tracking and data collection.
Signature
static trackingOptIn(): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// User has opted in to tracking
NativeSingular.trackingOptIn();
import { Singular } from 'singular-react-native';
// User has opted in to tracking
Singular.trackingOptIn();
trackingUnder13
Singular.trackingUnder13 Method
Indicates that the user is under 13 years old. Call this method to comply with COPPA and other regulations for users under 13 years old.
Signature
static trackingUnder13(): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Notify Singular the user is under 13 years old
NativeSingular.trackingUnder13();
import { Singular } from 'singular-react-native';
// Notify Singular the user is under 13 years old
Singular.trackingUnder13();
unsetCustomUserId
Singular.unsetCustomUserId Method
Removes the previously set custom user ID. Call this method when the user logs out or when you no longer want to associate events with the current user ID.
Signature
static unsetCustomUserId(): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Clear custom user ID when user logs out
NativeSingular.unsetCustomUserId();
import { Singular } from 'singular-react-native';
// Clear custom user ID when user logs out
Singular.unsetCustomUserId();
unsetGlobalProperty
Singular.unsetGlobalProperty Method
Removes a previously set global property. Call this method when you no longer want a specific global property to be sent with events.
Signature
static unsetGlobalProperty(key: string): void
Usage Example
// TurboModule direct API (React Native 0.76+ New Architecture)
import NativeSingular from 'singular-react-native/js/NativeSingular';
// Remove a global property
NativeSingular.unsetGlobalProperty('user_tier');
import { Singular } from 'singular-react-native';
// Remove a global property
Singular.unsetGlobalProperty('user_tier');