Apple Search Ads
Overview
When you opt in, the BillDog analytics module reads Apple’s AdServices attribution token, exchanges it with Apple’s attribution API, and records the result as an $install analytics event. It also saves the result on the device.
Revenue joining is coming soon. Today the Search Ads result is only that $install event. BillDog doesn’t yet join it to purchases, trials or renewals, or show it in the Attribution dashboard.
iOS only. Apple Search Ads attribution requires AdServices.framework, which exists only on iOS 14.3+. There is no Android equivalent — use the attribution provider setters for Android install attribution.
Enable it
Attribution is off by default. fetchAttribution() lives on the analytics module, BillDogAnalyticsManager. Register the module yourself, then call it:
- Create one
BillDogAnalyticsManagerand keep a reference to it. - Register it with
BillDog.shared.use(module:), and callBillDog.shared.configure(config:). Either order works.use(module:)configures the module immediately if the SDK is already configured. - Call
fetchAttribution(), after both. It is safe to call on every launch: the tracker records inUserDefaultsthat this install’s attribution was fetched, and never exchanges a token again.
Session tracking is not needed. fetchAttribution() works whether or not you turn on session or screen auto-tracking.
import UIKit
import BillDogFull
final class AppDelegate: NSObject, UIApplicationDelegate {
let analytics = BillDogAnalyticsManager()
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
BillDog.shared.use(module: analytics)
BillDog.shared.configure(config: .init(apiKey: "YOUR_API_KEY"))
// Opt in to Apple Search Ads attribution (iOS 14.3+).
analytics.fetchAttribution()
return true
}
}If the user has opted out of analytics, or analytics is disabled for the project, no $install event is recorded.
What gets captured
On a successful token exchange the analytics module records a $install event carrying the fields Apple returns:
| Property | Source | Description |
|---|---|---|
| apple_search_ads | — | Always true on this event, even when Apple found no match (check is_attributed) |
| is_attributed | attribution | Whether Apple matched the install to a campaign |
| campaign_id | campaignId | Search Ads campaign |
| org_id | orgId | Search Ads organisation |
| ad_group_id | adGroupId | Ad group within the campaign |
| keyword_id | keywordId | Matched keyword |
Attribution is fetched once per install, so each install records at most one $install. The result saved on the device is deleted after 30 days; that doesn’t fetch it again. If Apple returns a non-200 response, or the token can’t be read (for example on the simulator), the install is marked as fetched and no event is recorded: BillDog doesn’t retry, and that install stays unattributed.
Privacy manifest & App Store review
The BillDog SDK’s own PrivacyInfo.xcprivacy declares only purchase history. It does not declare the data this feature collects, so you declare it yourself. Apps that call fetchAttribution() should declare Other Diagnostic Data (linked to the user, Analytics purpose) in their App Store privacy nutrition label. If you also turn on session or screen tracking, declare User ID and Product Interaction too.
AAAttribution.attributionToken() does not require App Tracking Transparency authorisation. For the IDFA, see the device identifiers section of Attribution Integrations.
Related
Was this page helpful?
Or rate this page: