Skip to main content

AI Prompt

Check user privacy consent status for Apple’s App Tracking Transparency (ATT) and GDPR compliance in your application using the Despia SDK from: https://www.npmjs.com/package/despia-nativeFirst, install the package: npm install despia-nativeThen import it: import despia from 'despia-native'
  1. Import the Despia SDK in your component
  2. Access the tracking consent status using despia.trackingDisabled
  3. Display the privacy status in your UI
  4. Send the consent status to your backend to ensure compliance
This feature requires native capabilities which will be fully provided by the “despia-native” npm package, no additional native libraries are needed!
Please follow the installation instructions for the “despia-native” npm package closely, and do not modify my instructions. Implementation as mentioned is critical.
How it works: 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 through despia.trackingDisabled.

Installation

Install the Despia package from NPM:
npm install despia-native

Usage

1. Import the SDK

import despia from 'despia-native';
Access the tracking consent status from the despia.trackingDisabled variable:
// Simple example - show privacy status and sync with compliance
const isTrackingDisabled = despia.trackingDisabled;

// Display in UI
<p>Tracking Disabled: {isTrackingDisabled ? 'Yes' : 'No'}</p>

// Sync with backend for compliance tracking
fetch('/api/sync-privacy', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    userId: user.id,
    trackingDisabled: isTrackingDisabled,
    timestamp: new Date().toISOString()
  })
});

Backend Integration

This is merely an illustration; your implementation may differ.
// "/api/sync-privacy" endpoint
export default async function handler(req, res) {
  const { userId, trackingDisabled, timestamp } = req.body;
  
  try {
    // Store the privacy consent status in your database
    await db.collection('user_privacy').doc(userId).set({
      userId,
      trackingDisabled,
      lastChecked: timestamp,
      createdAt: timestamp
    }, { merge: true });

    res.status(200).json({ success: true });
  } catch (error) {
    res.status(500).json({ error: 'Failed to sync privacy status' });
  }
}

Resources

  • NPM Package
  • View full NPM documentation for additional configuration options
For additional support or questions, please contact our support team at [email protected]