Skip to main content

Allow Apps to Request to Track (sys.user_tracking / sys.set_user_tracking)

This function is available in versions after 20260529

Declaration

allow_tracking_requests = sys.user_tracking()
success = sys.set_user_tracking(allow_tracking_requests)

Parameters

  • allow_tracking_requests
    Boolean. Whether apps are allowed to request tracking. true means allowed, false means not allowed.

Returns

  • allow_tracking_requests
    Boolean or nil. Whether apps are currently allowed to request tracking. Returns nil when the value cannot be read.
  • success
    Boolean. Whether the setting was applied successfully.

Description

Gets or sets the Settings > Privacy & Security > Tracking > Allow Apps to Request to Track switch.
The setting name or location may differ slightly across iOS versions.

Example

local allow = sys.user_tracking()

if type(allow) == "boolean" then
sys.set_user_tracking(false)

-- Restore the previous state when needed
sys.set_user_tracking(allow)
else
sys.toast("Cannot read tracking setting")
end