Skip to content

Latest commit

 

History

History
140 lines (98 loc) · 2.65 KB

README.md

File metadata and controls

140 lines (98 loc) · 2.65 KB

iOS-Capacitor-App-Tracking

Adds App Tracking Transparency for iOS 14


Release Note:

v1.0.3

  • Bug fixes.

v1.0.2

  • Added Capacitor 3.0 Support.

v0.1.1

  • iOS 14 App Tracking Transparency.

Supported Platform:

  • 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

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';