react-native-apple-ads-attribution
Fetches apple attribution data via AdServices APIs. (iAd services is deprecated and getting error in XCODE 16. That is reason i removed all references to iAd from this npm.)
Requirements
Installation
npm install @vladikstyle/react-native-apple-ads-attribution
Usage
import AppleAdsAttribution from "@vladikstyle/react-native-apple-ads-attribution";
const attributionData = await AppleAdsAttribution.getAttributionData();
const adServicesAttributionToken = await AppleAdsAttribution.getAdServicesAttributionToken();
const adServicesAttributionData = await AppleAdsAttribution.getAdServicesAttributionData();
Note from version 1.0 the above functions propagates errors, so they should be wrapped in try/catch.
Documentation
getAttributionData()
Gets install attribution data first trying to use the AdServices API (iOS 14.3+).
If it fails to retrieve data it will fallback to iAd API.
Throws error if everything fails
Example
try {
const iAdAttributionData = await AppleAdsAttribution.getiAdAttributionData()
console.log(iAdAttributionData)
} catch (error) {
const { message } = error
console.log(message)
}
getAdServicesAttributionToken()
Generates a AdServices token valid for 24 hours that then can be used to request attribution data from Apples AdServices API, see https://developer.apple.com/documentation/adservices
Throws error if token couldn't be generated
Example
try {
const adServicesAttributionToken = await AppleAdsAttribution.getAdServicesAttributionToken()
console.log(adServicesAttributionToken)
} catch (error) {
const { message } = error
console.log(message)
}
getAdServicesAttributionData()
Generates a AdServices token and uses it to request attribution data from Apples AdServices API, see https://developer.apple.com/documentation/adservices
Throws error if data couldn't be fetched.
Example
try {
const adServicesAttributionData = await AppleAdsAttribution.getAdServicesAttributionData()
console.log(adServicesAttributionData)
catch (error) {
const { message } = error
console.log(message)
}
License
MIT