deviceID

❗️

Deprecated

This property is no longer recommended. Audience Manager is no longer available in the latest product version, and the SDK forwards the device ID only on Audience Manager requests.

The deviceID property sets a device-level identifier that the SDK forwards to Audience Manager as the device_id parameter. The SDK accepts any non-empty string, so you choose what to send. A common choice on iOS is the IDFA (Apple's Identifier for Advertisers), but you can also pass any unique identifier your app controls. The default value is nil, in which case no device_id is sent.

Syntax

import AdSupport

let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
PiwikTracker.sharedInstance()?.deviceID = idfa
#import <AdSupport/ASIdentifierManager.h>

NSString *idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
[PiwikTracker sharedInstance].deviceID = idfa;

Parameters

  • deviceID string, optional - A device-level identifier forwarded to Audience Manager as the device_id parameter. The SDK accepts any non-empty string. Default: nil (no device_id is sent).

Examples

To use the IDFA as the device ID:

import AdSupport

let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
PiwikTracker.sharedInstance()?.deviceID = idfa
#import <AdSupport/ASIdentifierManager.h>

NSString *idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
[PiwikTracker sharedInstance].deviceID = idfa;

Notes

  • The device ID is forwarded as the device_id parameter on Audience Manager requests.
  • The device ID won't be sent if isAnonymizationEnabled = YES is set.
  • If you choose to use the IDFA, make sure your usage matches the purposes you declare in App Store Connect and complies with App Tracking Transparency. If you do not need the IDFA, pass another identifier that you control instead.

Related methods