Swift Module: Attribution

Swift Module: Attribution

by on ‎12-22-2017 06:44 AM - edited 2 weeks ago (622 Views)


Adds the user-resettable advertising identifier (IDFA) to each tracking call and optionally implements the Apple Search Ads API to gather attribution information (see [[external]: Apple Search Ads](https://searchads.apple.com/v/advanced/help/pdf/attribution-api.pdf for details)).

Supported Platforms

  • iOS



Framework will be auto-instantiated, so long as the pod is installed. Depends on TealiumCore pod. No additional import statements necessary besides import TealiumSwift.

pod 'tealium-swift/TealiumAttribution'


Framework will be auto-instantiated, so long as it is compiled into your app (included in "Embedded Binaries"). Depends on TealiumCore. No additional import statements necessary.


External Dependencies

UIKit, AdSupport, iAd

Recommended Usage

Usage of this module is optional. Please take the time to read about its functionality and decide if you really need it, as it introduces additional dependencies. Additionally, you will be required to explain to Apple why you are using IDFA when you submit your app. It should suffice to say that you are using it for attribution purposes. If you do not state that you are using IDFA, Apple will reject your app (see [external]: IDFA Usage).

If you choose to exclude the module, the variables listed below will not be included in tracking calls.

Included Variables

The following variables will be transmitted with each tracking call while the module is enabled:

Variable Name Description Example Value
device_advertising_id User-resettable advertising identifier (IDFA) 6D92078A-8246-4BA4-AE5B-76104861E7DC
device_advertising_vendor_id Unique ID guaranteed to be the same across all apps on the same device from a single vendor (apps with the same 1st 2 parts of the RDNS bundle identifier e.g. com.tealium or com.acme) 6D92078A-8246-4BA4-AE5B-76104861E7DC
device_advertising_enabled Boolean to indicate whether the user has allowed ad tracking. True if ad tracking enabled, otherwise false. Note: if false, the advertising ID will appear as a string of zeroes true
ad_user_clicked_last_30_days* True if user clicked on a Search Ads impression within 30 days prior to app download. true
ad_user_date_clicked* Date and time the user clicked on a corresponding ad 2016-12-05T17:31:40Z
ad_user_date_converted* Date and time the user downloaded your app 2016-12-05T17:31:40Z
ad_org_name* The organization that owns the campaign the corresponding ad was part of. OrgName
ad_campaign_id* The ID of the campaign the corresponding ad was part of 1234567890
ad_campaign_name* The name of the campaign the corresponding ad was part of CampaignName
ad_group_id* The ID of the ad group the corresponding ad was part of 1234567890
ad_group_name* The name of the ad group the corresponding ad was part of. AdGroupName
ad_keyword* The keyword that drove the ad impression which led to the corresponding ad click. Keyword

* Note: these variables are only enabled if Search Ads has been explicitly enabled in the TealiumConfig object. These variables will only be retrieved from Apple's servers once during the app's lifetime, but they will be stored as persistent variables so they are available on future app launches.

Future Improvements

Update IDFA functionality to have a more robust retry mechanism if IDFA retrieval fails the first time (documented Apple limitation).

Change Log


  • No functional changes. Minor code change to import TealiumCore module for Carthage builds.
  • Removed unnecessary code for Swift versions <4.0 (no longer supported due to Xcode deprecation of Swift 3).


  • "device_advertising_id" has been changed from Identifier for Vendor (IDFV) to Identifier for Advertisers (IDFA). A new variable "device_advertising_vendor_id" has been added, which contains the IDFV.
  • Added support for Apple Search Ads API. If this module is implemented, Tealium will collect attribution information from the Apple Search Ads API.