### ASIdentifierManager - Getting the Advertising Identifier Source: https://developer.apple.com/documentation/adsupport/asidentifiermanager This section describes how to obtain the shared instance of the ASIdentifierManager and retrieve the device-specific advertising identifier. ```APIDOC ## ASIdentifierManager - Getting the Advertising Identifier ### Description This section describes how to obtain the shared instance of the ASIdentifierManager and retrieve the device-specific advertising identifier. ### Method `class func shared() -> ASIdentifierManager` ### Endpoint N/A (This is a class method in Swift) ### Parameters None ### Request Body None ### Response #### Success Response - **shared()**: Returns an instance of `ASIdentifierManager`. - **advertisingIdentifier** (UUID) - The UUID that is specific to a device. ### Response Example ```swift let identifierManager = ASIdentifierManager.shared() let adIdentifier = identifierManager.advertisingIdentifier ``` ``` -------------------------------- ### GET shared() Source: https://developer.apple.com/documentation/adsupport/asidentifiermanager/shared%28%29 Retrieves the shared instance of the ASIdentifierManager class. ```APIDOC ## GET shared() ### Description Returns the shared instance of the AdSupport identifier manager class. ### Method class func ### Endpoint ASIdentifierManager.shared() ### Return Value - **ASIdentifierManager** (object) - The shared instance of the identifier manager class. ### Availability - iOS 6.0+ - iPadOS 6.0+ - Mac Catalyst 13.1+ - macOS 10.14+ - tvOS 6.0+ ``` -------------------------------- ### Get Advertising Identifier Source: https://developer.apple.com/documentation/adsupport Use this code to retrieve the advertising identifier from the AdSupport framework. Ensure you have imported the AdSupport framework. On iOS 14.5+ and iPadOS 14.5+, you must first request user tracking authorization. ```swift import AdSupport let sharedASIdentifierManager = ASIdentifierManager.shared() var adID = sharedASIdentifierManager.advertisingIdentifier ``` -------------------------------- ### Get Advertising Identifier Source: https://developer.apple.com/documentation/adsupport/asidentifiermanager/advertisingidentifier Access the device-specific UUID for advertising purposes. On iOS 14.5+, ensure tracking authorization is obtained first. ```swift var advertisingIdentifier: UUID { get } ``` -------------------------------- ### ASIdentifierManager Shared Instance Source: https://developer.apple.com/documentation/adsupport/asidentifiermanager/advertisingidentifier Retrieves the shared instance of the ASIdentifierManager class, which provides access to the advertising identifier. ```APIDOC ## ASIdentifierManager ### Description Provides access to the shared instance of the identifier manager class. ### Method `class func shared() -> ASIdentifierManager` ### Discussion Use this method to get the shared instance of `ASIdentifierManager` to access properties like `advertisingIdentifier`. ``` -------------------------------- ### Access the shared ASIdentifierManager instance Source: https://developer.apple.com/documentation/adsupport/asidentifiermanager/shared%28%29 Use this method to obtain the singleton instance of the identifier manager class. ```swift class func shared() -> ASIdentifierManager ``` -------------------------------- ### Retrieve the Advertising Identifier Source: https://developer.apple.com/documentation/AdSupport Use the ASIdentifierManager shared instance to access the advertisingIdentifier property. Ensure the app has requested tracking authorization before accessing this value on supported OS versions. ```swift import AdSupport let sharedASIdentifierManager = ASIdentifierManager.shared() var adID = sharedASIdentifierManager.advertisingIdentifier ``` -------------------------------- ### ASIdentifierManager - isAdvertisingTrackingEnabled Source: https://developer.apple.com/documentation/adsupport/asidentifiermanager/isadvertisingtrackingenabled This property returns a Boolean value indicating whether the user has limited ad tracking enabled. It is deprecated and should not be used in new development. ```APIDOC ## ASIdentifierManager - isAdvertisingTrackingEnabled ### Description A Boolean value that indicates whether the user has limited ad tracking enabled. ### Method GET ### Endpoint N/A (Instance Property) ### Parameters None ### Request Example None ### Response #### Success Response (200) - **isAdvertisingTrackingEnabled** (Bool) - A boolean value indicating if ad tracking is limited. #### Response Example ```json { "isAdvertisingTrackingEnabled": true } ``` ### Deprecation Deprecated in iOS 6.0–14.0, iPadOS 6.0–14.0, Mac Catalyst 13.1–14.0, macOS 10.14–11.0, and tvOS 6.0–14.0. ``` -------------------------------- ### advertisingIdentifier Property Source: https://developer.apple.com/documentation/adsupport/asidentifiermanager/advertisingidentifier The advertisingIdentifier is a UUID that is specific to a device and used for advertising purposes. Its value depends on user tracking permissions and the operating system version. ```APIDOC ## advertisingIdentifier ### Description The `advertisingIdentifier` is an alphanumeric string that’s unique to each device, and which you only use for advertising. Use this string for frequency capping, attribution, conversion events, estimating the number of unique users, advertising fraud detection, and debugging. On devices running iOS 14.5 and later and iPadOS 14.5 and later, your app must request tracking authorization before it can get the advertising identifier. ### Method `var advertisingIdentifier: UUID { get }` ### Discussion The advertising identifier returns either a unique UUID, or all zeros. **Returns a unique UUID if:** * Settings > Privacy > Tracking > Allow Apps to Request to Track is On, you’ve requested tracking authorization from the user by calling the App Tracking Transparency APIs, and received authorization (`ATTrackingManager.AuthorizationStatus.authorized`). * The user changes Settings > Privacy > Tracking > Allow Apps to Request to Track to Off after authorizing your app, and leaves the permissions On for your app. **Returns all zeros (`00000000-0000-0000-0000-000000000000`) if:** * In Simulator, regardless of any settings. * On devices running macOS. * On a compatible iPad or iPhone app running in visionOS. * On devices running iOS 14.5 and later and iPadOS 14.5 and later, if you haven’t requested authorization using the App Tracking Transparency framework. * You’ve requested authorization using the App Tracking Transparency framework and the user declines (`ATTrackingManager.AuthorizationStatus.denied`). * A profile or configuration restricts access to the advertising identifier (`ATTrackingManager.AuthorizationStatus.restricted`). **Best Practice:** Don’t store the advertising identifier value; access `advertisingIdentifier` instead. Users can change their authorization for tracking at any time. Check your app’s authorization using `trackingAuthorizationStatus`. ``` -------------------------------- ### ASIdentifierManager - Deprecated Property Source: https://developer.apple.com/documentation/adsupport/asidentifiermanager This section details a deprecated property of the ASIdentifierManager class related to ad tracking. ```APIDOC ## ASIdentifierManager - Deprecated Property ### Description This section details a deprecated property of the ASIdentifierManager class related to ad tracking. ### Method `var isAdvertisingTrackingEnabled: Bool` ### Endpoint N/A (This is a property in Swift) ### Parameters None ### Request Body None ### Response #### Success Response - **isAdvertisingTrackingEnabled** (Bool) - A Boolean value that indicates whether the user has limited ad tracking enabled. This property is deprecated. ### Response Example ```swift // Accessing the deprecated property (not recommended) let trackingEnabled = ASIdentifierManager.shared().isAdvertisingTrackingEnabled ``` ``` -------------------------------- ### Access isAdvertisingTrackingEnabled property Source: https://developer.apple.com/documentation/adsupport/asidentifiermanager/isadvertisingtrackingenabled Access the Boolean value indicating ad tracking status. This property is deprecated as of iOS 14.0. ```swift var isAdvertisingTrackingEnabled: Bool { get } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.