Skip to main content
trackingconsent://request shows Apple’s tracking prompt on iOS, and trackingconsent://status reads the current answer without a prompt. On Android, where there is no tracking prompt, both read the device’s ad-tracking setting. Every answer also updates despia.trackingDisabled before your callback runs, so the two never disagree. The tracking status is separate from an advertising SDK’s own data choices. This call installs no advertising SDK and does not guarantee an advertising identifier or an attribution result.

Calls

Both take an optional request_id (at most 128 bytes), which is echoed in the answer so you can match it to your call. A call with a longer request_id gets no answer, and on iOS so does a call from a frame: call from your page’s top document.

The answer

The answer is stored in window.despiaTrackingConsent, window.trackingDisabled is updated, and then window.onDespiaTrackingConsent(answer) is called:
despia.trackingDisabled is false only for authorized. Answers belong to the document that asked. If the page navigates or reloads while the prompt is open, the answer is dropped; read status again on the new page.

When to ask

By default the app asks at launch. When your app’s settings turn the launch prompt off, nothing is asked until your page calls trackingconsent://request, and despia.trackingDisabled stays true until the user allows tracking. Ask from a tap, after you explain why. iOS shows its prompt once: a later request cannot change an earlier answer or a device restriction, and answers the current status. On iOS the user changes it in Settings, and the app picks the change up when it returns to the foreground.

Ads

On iOS, AdMob requests are non-personalised for every status except authorized, in every build.

Platform notes

Rebuild the app after you change tracking settings: they are compiled into the app, and a web update does not change them.