# iOS App Tracking Transparency

{% hint style="info" %}

<pre data-overflow="wrap"><code>You'll need to import the javascript file in your website before starting from this <a data-footnote-ref href="#user-content-fn-1">link</a>.
</code></pre>

{% endhint %}

For iOS 14.5+, Apps must take Tracking Consent from user if your app collects data about end users and shares it with other companies for purposes of tracking across apps and web sites.

To use AppTrackingTransparency you will need to enable Request Tracking Authorization from App permission tab.

<figure><img src="/files/mI2J1xcd1eMV7SY2qfiZ" alt=""><figcaption><p>App Tracking Transparency Setting</p></figcaption></figure>

There are two ways apps can prompt user for permission

* **On App load**: if Request Tracking consent on load is enabled then app will prompt user for Tracking consent on app launch
* **Manually**: If Request Tracking consent on load is disabled, you can call below javascript interface manually to ask for Tracking consent

{% tabs %}
{% tab title="Plain JS" %}

```markup
const { ATTConsent } = window.WTN

ATTConsent.request({
 callback:function(result){
   if(result.granted){
     //Permission Granted or ios version 14.4 or lower
   }else{
     //Permission Denied / not Determined due to some restrictions
   }
 }
})

```

{% endtab %}

{% tab title="ES 6+" %}

```
import { request } from "webtonative/ATTConsent"

request({
 callback:function(result){
   if(result.granted){
     //Permission Granted or ios version 14.4 or lower
   }else{
     //Permission Denied / not Determined due to some restrictions
   }
 }
})

```

{% endtab %}
{% endtabs %}

To check whether Tracking consent was given (either through the manual prompt or automatic prompt), you can call following method:

{% tabs %}
{% tab title="Plain JS" %}

```markup
const { ATTConsent } = window.WTN

ATTConsent.status({
 callback:function(result){
   if(result.granted){
     //Permission Granted or ios version 14.4 or lower
   }else{
     //Permission Denied / not Determined due to some restrictions / not asked
   }
 }
})

```

{% endtab %}

{% tab title="ES 6+" %}

```
import { status } from "webtonative/ATTConsent"

status({
 callback:function(result){
   if(result.granted){
     //Permission Granted or ios version 14.4 or lower
   }else{
     //Permission Denied / not Determined due to some restrictions / not asked
   }
 }
})

```

{% endtab %}
{% endtabs %}

**Note :**&#x20;

* The result object will be { granted: true|false } based on the user's response to the consent prompt.
* For iOS 14.4 and lower, result object will always be { granted: true}

[^1]: <https://docs.webtonative.com/javascript-apis/getting-started>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.webtonative.com/javascript-apis/ios-app-tracking-transparency.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
