capacitor-ios-app-tracking
v1.0.5-rc1
Published
App AD Tracking for iOS 14 and above
Downloads
3,552
Readme
iOS-Capacitor-App-Tracking
Adds App Tracking Transparency for iOS 14
Release Note:
v1.0.5rc1
- [README updated]
v1.0.4
- Bug fixes.
v1.0.3
- Bug fixes.
v1.0.2
- Added Capacitor 3.0 Support.
v0.1.1
- iOS 14 and iOS 15 App Tracking Transparency.
Supported Platform:
- [x] iOS
- [ ] Android
- [ ] Web
Supported methods
| Name | Returns | Type |
| :---------------- | ------------- | --------------------------------- |
| getTrackingStatus | Promise
| IOSAppTrackingStatus |
| requestPermission | Promise
| IOSAppTrackingStatus |
Install
npm install capacitor-ios-app-tracking
npx cap sync
Info.plist
Add this
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
API Usage
getTrackingStatus() => Promise<IOSAppTrackingStatus>)
requestPermission() => Promise<IOSAppTrackingStatus>)
getTrackingStatus() => Promise
import { AppTrackingTransparency } from "capacitor-ios-app-tracking";
useEffect(() => {
AppTrackingTransparency.getTrackingStatus().then((status) => {
console.log(status);
});
}, []);
requestPermission() => Promise
import { AppTrackingTransparency } from "capacitor-ios-app-tracking";
useEffect(() => {
AppTrackingTransparency.requestPermission().then((status) => {
console.log(status);
});
}, []);
interface IOSAppTrackingPlugin
export interface IOSAppTrackingPlugin {
getTrackingStatus(): Promise<IOSAppTrackingResponse>;
requestPermission(): Promise<IOSAppTrackingResponse>;
}
interface IOSAppTrackingResponse
interface IOSAppTrackingResponse {
code: string;
status: IOSAppTrackingStatus;
}
type IOSAppTrackingStatus
type IOSAppTrackingStatus =
| 'authorized'
| 'denied'
| 'unrequested'
| 'restricted';