The Despia Apple Privacy Status SDK enables your application to check a user's privacy consent status to ensure compliance with Apple's App Tracking Transparency (ATT), GDPR tracking requirements, and other privacy regulations. This lightweight solution helps your app adhere to App Store guidelines and user consent rules.
Quick Start
1. Check Tracking Status
Determine if the user has disabled tracking by using the Despia command.
// Check tracking status
window.despia = "user-disable-tracking://"
// Access the tracking status
console.log("Tracking disabled:", trackingDisabled)
2. Handle Privacy Status
Based on the tracking status, adjust your app's functionality to respect user privacy choices.
window.despia = "user-disable-tracking://"
if (trackingDisabled) {
// User disabled tracking
showPrivacyFriendlyAds()
} else {
// User allowed tracking
showPersonalizedAds()
}
3. Integrate with Your Systems
Incorporate the privacy status into your analytics and advertising configurations.
window.despia = "user-disable-tracking://"
// Example of how to use this callback with other SDKs
initializeAnalytics({
tracking: !trackingDisabled,
mode: trackingDisabled ? 'privacy' : 'full'
})
How It Works
The SDK communicates with the native device to retrieve the user's current privacy preferences regarding tracking. When you call the user-disable-tracking://
command, the SDK sets a trackingDisabled
variable that you can access after a short delay.
This approach works with native iOS components to ensure your app respects privacy choices made through Apple's App Tracking Transparency framework, helping you maintain compliance with privacy regulations.
Implementation Example
Here is an example of how to implement the Privacy Status SDK in various scenarios to ensure proper privacy compliance.
// Basic Check
window.despia = "user-disable-tracking://"
// Example handling the result
if (trackingDisabled) {
// EXAMPLES FOR PRIVACY-COMPLIANT IMPLEMENTATION (for NoCode/LowCode Tools)
// ---------- WEWEB ----------
// WEWEB example using wwWorkflow to handle privacy settings
// 1. Create a Native WeWeb Global Workflow and return the variable:
return trackingDisabled
// 2. This will now return the value via the code-block
// 3. Process the code-block response accordingly, such as setting a variable or calling an API.
// ---------- WIZED ----------
// WIZED example using Wized's JS API
// Store the detected privacy setting in a Wized variable
v.userPrivacyStatus = trackingDisabled;
// OPTIONAL - Create a request (API Call) that will send privacy information to adjust settings
const result = await Wized.requests.execute('REQUEST NAME TO PROCESS PRIVACY STATUS');
console.log(result); // Or set result as variable for privacy-compliant implementation
// ---------- NORDCRAFT / TODDLE ----------
// For Nordcraft / Toddle - simply trigger an event with the privacy data
// Create a custom event handler in your project settings
ctx.triggerActionEvent("onPrivacyStatusDetected", {
privacyStatus: trackingDisabled,
timestamp: new Date().getTime(),
});
} else {
// Similar implementation for tracking-allowed scenario
// Implement personalized experiences here...
}
Data Structure
The SDK provides a simple boolean value that indicates whether tracking has been disabled by the user.
// The variable trackingDisabled will be set to true if user has opted out of tracking
const trackingDisabled = true; // or false depending on user preference
Best Practices
Implementation
-
Ensure you handle both tracking states (enabled and disabled)
-
Test your application in both privacy scenarios
Privacy Compliance
-
Always respect the user's privacy choice
-
Provide alternative features when tracking is disabled
-
Update your privacy policy to reflect tracking practices
Troubleshooting
Common Issues
Undefined trackingDisabled Variable
-
Ensure you're using the correct Despia command format
-
Check for JavaScript errors in your console
Inconsistent Behavior
-
Test on actual iOS devices, not just simulators
-
Verify compatibility with your iOS version
-
Ensure you're handling the tracking status correctly
For additional support or questions, please contact our support team at support@despia.com