Skip to content

amontech/capacitor-ios-app-tracking

 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 44.5%
  • TypeScript 21.3%
  • Ruby 14.9%
  • Objective-C 11.8%
  • JavaScript 7.5%