React Native module to get the Advertising Identifier (IDFA on iOS, AAID on Android).
This is the Aiir fork of the archived
@sparkfabrik/react-native-idfa-aaidpackage. The upstream repo was archived by SparkFabrik in November 2025. We forked it to add React Native New Architecture (TurboModule) support. See CLAUDE.md for technical details of the changes made.
The Advertising Identifier (IDFA on iOS, AAID on Android) is a device-specific, resettable ID used for advertising attribution. This module exposes it to React Native, respecting OS-level user permission.
Both methods return:
interface AdvertisingInfoResponse {
id: string | null; // null if tracking is not permitted
isAdTrackingLimited: boolean;
}This package is consumed as a GitHub dependency. Add it to your package.json:
"@sparkfabrik/react-native-idfa-aaid": "github:aiir/react-native-idfa-aaid#v1.2.0-aiir.1"Then run npm install and pod install in your ios folder.
Add the tracking usage description to Info.plist:
<key>NSUserTrackingUsageDescription</key>
<string>Your description here</string>import ReactNativeIdfaAaid, { AdvertisingInfoResponse } from '@sparkfabrik/react-native-idfa-aaid';
const MyComponent: React.FC = () => {
const [idfa, setIdfa] = useState<string | null>(null);
useEffect(() => {
ReactNativeIdfaAaid.getAdvertisingInfo()
.then((res: AdvertisingInfoResponse) =>
!res.isAdTrackingLimited ? setIdfa(res.id) : setIdfa(null),
)
.catch((err) => {
console.log(err);
setIdfa(null);
});
}, []);
// ...
};iOS 17.4 has a bug where ATTrackingManager can return denied before the permission
dialog has been shown. Use getAdvertisingInfoAndCheckAuthorization(true) to apply a
workaround that registers an observer and re-checks when the app next becomes active:
import ReactNativeIdfaAaid, { AdvertisingInfoResponse } from '@sparkfabrik/react-native-idfa-aaid';
const MyComponent: React.FC = () => {
const [idfa, setIdfa] = useState<string | null>(null);
useEffect(() => {
ReactNativeIdfaAaid.getAdvertisingInfoAndCheckAuthorization(true)
.then((res: AdvertisingInfoResponse) =>
!res.isAdTrackingLimited ? setIdfa(res.id) : setIdfa(null),
)
.catch((err) => {
console.log(err);
setIdfa(null);
});
}, []);
// ...
};Pass false (or use getAdvertisingInfo()) if you do not need the workaround.
MIT — see LICENSE.