Skip to main content
The Settings module provides methods to configure the Facebook SDK, including app credentials, API versions, data collection, and privacy settings.

Import

Methods

initializeSDK

Initializes the Facebook SDK. This should be called early in your app lifecycle.
Example:

setAppID

Sets your Facebook application ID.
string
required
Your Facebook App ID. Must be a non-empty string.
Example:

setClientToken

Sets your Facebook client token for client-side API calls.
string
required
Your Facebook client token. Must be a non-empty string.
Example:

setAppName

Sets the Facebook application name.
string
required
Your app’s name as registered on Facebook. Must be a non-empty string.
Example:

setGraphAPIVersion

Sets the Graph API version to use for all requests.
string
required
The Graph API version (e.g., “v18.0”, “v19.0”). Must be a valid version string.
Example:

setAutoLogAppEventsEnabled

Enables or disables automatic app event logging.
boolean
required
true to enable automatic logging of app events (installs, launches, etc.), false to disable.
Example:

setAdvertiserIDCollectionEnabled

Enables or disables automatic collection of advertiser IDs.
boolean
required
true to collect advertiser IDs (IDFA on iOS, Advertising ID on Android), false to disable.
Example:

setDataProcessingOptions

Configures data processing options for privacy compliance (e.g., CCPA).
Array<string>
required
Array of data processing options. Use ['LDU'] for Limited Data Use mode, or [] for normal processing.
number
Country code (0 for user’s current country). Defaults to 0.
number
State code (0 for user’s current state). Defaults to 0.
Example:

getAdvertiserTrackingEnabled

Gets the current Advertiser Tracking Enabled status. iOS only.
Returns a Promise that resolves to:
  • true if tracking is enabled (iOS)
  • true on Android (always enabled)
Example:

setAdvertiserTrackingEnabled

Sets the Advertiser Tracking Enabled status. iOS 14+ only.
boolean
required
true to enable tracking, false to disable.
Returns a Promise that resolves to:
  • true if the setting was applied successfully (iOS 14+)
  • false on Android or iOS < 14
Example:

Complete Setup Example

Privacy-Compliant Setup

Configuration by Environment

iOS 14+ ATT Integration

CCPA Compliance

Best Practices

  1. Call initializeSDK() early in your app lifecycle
  2. Set app credentials before initializing
  3. Specify Graph API version explicitly for consistency
  4. Respect user privacy choices for data collection
  5. Handle platform differences (iOS vs Android)
  6. Test privacy settings in both enabled and disabled states
  7. Keep SDK updated to the latest version
  8. Use environment-specific configs for dev/prod

Platform Differences

iOS

  • Full ATT framework support
  • getAdvertiserTrackingEnabled() returns actual status
  • setAdvertiserTrackingEnabled() works on iOS 14+

Android

  • getAdvertiserTrackingEnabled() always returns true
  • setAdvertiserTrackingEnabled() returns false (no-op)
  • Advertiser ID controlled by user’s system settings