Prerequisites
To enable Apple Ads, you first need to:
Create a Branch Dashboard.
Enable Ads for your Branch account. Contact your Branch account manager or visit https://branch.io/pricing.
Have a mobile developer prepared to implement the Apple Ads token.
Have admin access to your Apple Ads account.
Configure token
You have to choose one of the following options for retrieving the Apple Ads Token to get started with enabling Apple Ads with Branch:
via SDK or
via Server-to-Server (S2S)
Note
For either methods, be sure to import the
AdServicesFramework to leverage the Apple Ads Attribution API.
Configure token via SDK
Implement the latest version of the Branch iOS SDK.
The Branch SDK will automatically retrieve a token on your behalf. Branch servers will use that token to call the Apple Ads Attribution API.
Configure token via server-to-server
For S2S integrations, you will need to retrieve the new token and send it to Branch on the install as apple_attribution_token. This is necessary only if you are integrating Branch through an S2S connection.
Import
AdServices.frameworkRequest attribution token. This should be available from Apple within 50ms.
func appleAttributionToken() -> String? {
if #available(iOS 14.3, *) {
return try? AAAttribution.attributionToken()
}
return nil
}+ (NSString *)appleAttributionToken {
#if !TARGET_OS_TV
if (@available(iOS 14.3, *)) {
NSError *error;
NSString *appleAttributionToken = [AAAttribution attributionTokenWithError:&error];
if (!error) {
return appleAttributionToken;
}
}
#endif
return nil;
}The token has a 24-hour time-to-live, so send it to Branch within that time to use it for attribution.
Complete Apple Ads setup
To finish enabling Apple Ads, please visit our dedicated guide in Marketer Hub.
