@ottimis/capacitor-ios-app-tracking
TypeScript icon, indicating that this package has built-in type declarations

3.0.6 • Public • Published

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.

Package Sidebar

Install

npm i @ottimis/capacitor-ios-app-tracking

Weekly Downloads

114

Version

3.0.6

License

MIT

Unpacked Size

221 kB

Total Files

74

Last publish

Collaborators

  • mmoriani
  • ottimisgroup
  • gbetto
  • edoardo.croce