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.setAppID
Sets your Facebook application ID.string
required
Your Facebook App ID. Must be a non-empty string.
setClientToken
Sets your Facebook client token for client-side API calls.string
required
Your Facebook client token. Must be a non-empty string.
setAppName
Sets the Facebook application name.string
required
Your app’s name as registered on Facebook. Must be a non-empty string.
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.
setAutoLogAppEventsEnabled
Enables or disables automatic app event logging.boolean
required
true to enable automatic logging of app events (installs, launches, etc.), false to disable.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.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.
getAdvertiserTrackingEnabled
Gets the current Advertiser Tracking Enabled status. iOS only.trueif tracking is enabled (iOS)trueon Android (always enabled)
setAdvertiserTrackingEnabled
Sets the Advertiser Tracking Enabled status. iOS 14+ only.boolean
required
true to enable tracking, false to disable.trueif the setting was applied successfully (iOS 14+)falseon Android or iOS < 14
Complete Setup Example
Privacy-Compliant Setup
Configuration by Environment
iOS 14+ ATT Integration
CCPA Compliance
Best Practices
- Call
initializeSDK()early in your app lifecycle - Set app credentials before initializing
- Specify Graph API version explicitly for consistency
- Respect user privacy choices for data collection
- Handle platform differences (iOS vs Android)
- Test privacy settings in both enabled and disabled states
- Keep SDK updated to the latest version
- Use environment-specific configs for dev/prod
Platform Differences
iOS
- Full ATT framework support
getAdvertiserTrackingEnabled()returns actual statussetAdvertiserTrackingEnabled()works on iOS 14+
Android
getAdvertiserTrackingEnabled()always returnstruesetAdvertiserTrackingEnabled()returnsfalse(no-op)- Advertiser ID controlled by user’s system settings
Related
- AppEventsLogger - Log app events and user actions
- AEMReporter - iOS privacy-safe event measurement
- Facebook App Dashboard - Get your App ID and Client Token
- Graph API Versions - API version changelog