@ottimis/capacitor-ios-app-tracking
v3.0.6
Published
App AD Tracking for iOS 14.
Downloads
37
Readme
Capacitor3-iOS-IDFA-App-Tracking
Capacitor3-IDFA-iOS-App-Tracking is a native AppTrackingTransparency implementation for iOS 14. Now you can use this package as a Ionic Capacitor Plugin in your App.
Release Note:
v3.0.0
- Implemented Capacitor 3 support.
v0.1.1
- Implemented iOS 14 IDFA AppTrackingTransparency.
Supported Platform:
- [x] iOS
Screenshots
| | | | | |:-----------------|:------------------:|:------------------:|:------------------:| | iOS | | |
Supported methods
| Name | | :---------------- | | getTrackingStatus | | requestPermission |
Installation
Use Capacitor3-IDFA-iOS-App-Tracking plugins in your app.
npm install @ottimis/capacitor-ios-app-tracking
ionic cap update
iOS
Update Info.plist
Open your App/App/Info.plist file and add this plist value
line at the right spot (and replace the value with the message for the user!):
<key>NSUserTrackingUsageDescription</key>
<!-- replace this value with your message-->
<string>Message to Users.</string>
Example
import React, { useEffect } from "react"
import { Response, IOSAppTracking } from "@ottimis/capacitor3-ios-app-tracking";
const App: React.FC = () => {
const [ response, setResponse ] = useState<Response>()
useEffect(() => {
IOSAppTracking.getTrackingStatus().then((res: Response ) => setResponse(res))
}, [])
useEffect(() => {
if(response.status === 'unrequested') {
IOSAppTracking.requestPermission().then((res: Response) => console.log(res))
}
}, [response])
...
}
getTrackingStatus()
IOSAppTracking.getTrackingStatus().then((res: Response ) => console.log(res))
requestPermission()
IOSAppTracking.requestPermission().then((res: Response) => console.log(res))
Response
interface Response {
value: string;
status: Status;
}
Status
type Status = 'authorized' | 'denied' | 'unrequested' | 'restricted'
License
Capacitor-IDFA-iOS-App-Tracking is MIT licensed.