- iOS
- Android
$ cordova plugin add cordova-plugin-idfa
Use variable ANDROID_PLAY_ADID_VERSION to override dependency version on Android.
The API is available on the cordova.plugins.idfa global object.
Returns a Promise<object> with the following fields:
limitAdTracking:boolean- Whether usage of advertising id is allowed by user.idfa:string(iOS only) - Identifier for advertisers.trackingTransparencyStatus(iOS only):"NotAvailable"|"Authorized"|"Denied"|"Restricted"|"NotDetermined"- Tracking transparency status, available on iOS 14+ devices. On devices with iOS < 14 the value will always be"NotAvailable". For the meaning of other values see the tracking transparency API docs.aaid:string(Android only) - Android advertising ID.
cordova.plugins.idfa.getInfo().then(function(info) {
if (!info.limitAdTracking) {
console.log(info.idfa || info.aaid);
}
});