This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo TrackingTransparency

A library for tracking app users and managing tracking permissions.

Android
iOS
tvOS
Included in Expo Go
Recommended version:
~56.0.5

A library for tracking app users and managing tracking permissions. Provides access to advertising identifiers and manages the required permissions for tracking. Examples of data used for tracking include email address, device ID, advertising ID, and more. If the "Allow Apps to Request to Track" device-level setting is off, this permission will be denied. Be sure to add NSUserTrackingUsageDescription to your Info.plist to explain how the user will be tracked. Otherwise, your app will be rejected by Apple.

For more information on Apple's App Tracking Transparency framework, see their documentation.

Installation

Terminal
- npx expo install expo-tracking-transparency
- yarn expo install expo-tracking-transparency
- pnpm expo install expo-tracking-transparency
- bun expo install expo-tracking-transparency

If you are installing this in an existing React Native app, make sure to install expo in your project.

Configuration in app config

You can configure expo-tracking-transparency using its built-in config plugin if you use config plugins in your project (Continuous Native Generation (CNG)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.

Example app.json with config plugin

app.json
{ "expo": { "plugins": [ [ "expo-tracking-transparency", { "userTrackingPermission": "This identifier will be used to deliver personalized ads to you." } ] ] } }

Configurable properties

NameDefaultDescription
userTrackingPermission"Allow this app to collect app-related data that can be used for tracking you or your device."
Only for: 
iOS

Sets the iOS NSUserTrackingUsageDescription permission message in Info.plist.

Are you using this library in an existing React Native app?

If you're not using Continuous Native Generation (CNG) (you're using native android and ios projects manually), then you need to configure following permissions in your native projects:

  • For Android, add com.google.android.gms.permission.AD_ID permission to your project's android/app/src/main/AndroidManifest.xml.

    <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
  • For iOS, add NSUserTrackingUsageDescription key to your project's ios/[app]/Info.plist:

    <key>NSUserTrackingUsageDescription</key> <string>Your custom usage description string here.</string>

Usage

Basic tracking transparency usage
import { useEffect } from 'react'; import { Text, StyleSheet, View } from 'react-native'; import { requestTrackingPermissionsAsync } from 'expo-tracking-transparency'; export default function App() { useEffect(() => { (async () => { const { status } = await requestTrackingPermissionsAsync(); if (status === 'granted') { console.log('Yay! I have user permission to track data'); } })(); }, []); return ( <View style={styles.container}> <Text>Tracking Transparency Module Example</Text> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, });

API

import * as ExpoTrackingTransparency from 'expo-tracking-transparency';

No API data file found, sorry!

Permissions

Android

The following permissions are added automatically through the library's AndroidManifest.xml.

Android PermissionDescription
com.google.android.gms.permission.AD_IDAllows access to the Advertising ID for tracking and analytics. Required for apps targeting Android 13 (API level 33) or higher that use Google Play services' Advertising ID.

iOS

The following usage description keys are used by this library:

Info.plist keyDescription

NSUserTrackingUsageDescription

A message that informs the user why an app is requesting permission to use data for tracking the user or the device.