Skip to main content

App Tracking Transparency Capacitor plugin

Request and check iOS App Tracking Transparency permission for IDFA access

Install

bun add @capgo/capacitor-app-tracking-transparency bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-app-tracking-transparency
  • pnpm add @capgo/capacitor-app-tracking-transparency
  • yarn add @capgo/capacitor-app-tracking-transparency

Guide

How to use App Tracking Transparency in Capacitor

Using @capgo/capacitor-app-tracking-transparency

Capacitor App Tracking Transparency Plugin.

Install

bun add @capgo/capacitor-app-tracking-transparency
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { AppTrackingTransparency } from '@capgo/capacitor-app-tracking-transparency';

API at a glance

Method Description
getStatus Gets the current tracking authorization status without prompting the user.
requestPermission Requests user authorization to access app-related data for tracking. Displays the native iOS tracking permission dialog.

Examples

getStatus()

Gets the current tracking authorization status without prompting the user.

import { AppTrackingTransparency } from '@capgo/capacitor-app-tracking-transparency';

const { status } = await AppTrackingTransparency.getStatus();
if (status === 'authorized') {
  console.log('Tracking is authorized');
}

requestPermission()

Requests user authorization to access app-related data for tracking. Displays the native iOS tracking permission dialog.

import { AppTrackingTransparency } from '@capgo/capacitor-app-tracking-transparency';

const { status } = await AppTrackingTransparency.requestPermission();
switch (status) {
  case 'authorized':
    console.log('User authorized tracking');
    break;
  case 'denied':
    console.log('User denied tracking');
    break;
  case 'restricted':
    console.log('Tracking is restricted');
    break;
  case 'notDetermined':
    console.log('Status not determined');
    break;
}

Full reference

Keep going from Using @capgo/capacitor-app-tracking-transparency

If you are using Using @capgo/capacitor-app-tracking-transparency to plan native plugin work, connect it with @capgo/capacitor-app-tracking-transparency for the implementation detail in @capgo/capacitor-app-tracking-transparency, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.

FAQ

App Tracking Transparency plugin FAQ

How do I install the App Tracking Transparency plugin in a Capacitor app?

Run "bun add @capgo/capacitor-app-tracking-transparency" (or "npm install @capgo/capacitor-app-tracking-transparency"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-app-tracking-transparency" in your app code.

Does @capgo/capacitor-app-tracking-transparency work with React, Vue and Angular?

Yes. App Tracking Transparency is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-app-tracking-transparency support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-app-tracking-transparency free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-app-tracking-transparency/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses App Tracking Transparency without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship App Tracking Transparency changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo