Links

iOS App Tracking Transparency

You'll need to import the javascript file in your website before starting from this link.
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.
App Tracking Transparency Setting
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
Plain JS
ES 6+
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
}
}
})
import ATTConsent from "webtonative/ATTConsent"
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
}
}
})
To check whether Tracking consent was given (either through the manual prompt or automatic prompt), you can call following method:
Plain JS
ES 6+
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
}
}
})
import ATTConsent from "webtonative/ATTConsent"
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
}
}
})
Note :
  • 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}