iOS
The Identifier for Advertisers (IDFA) is a random device identifier assigned by Apple to a user’s device. Advertisers use this to track data so that they can deliver customized advertising. The IDFA is used for tracking and identifying a user (without revealing personal information), allowing advertisers to access aggregated data.
Enable IDFA
Since iOS 14, iPadOS 14, and tvOS 14, you will need to ask end users for their permission to track IDFA in each app. Apps that have IDFA logic without specifying this permission will be rejected by App Store. Since Amplitude v7.0.0, we have made IDFA logic to be fully customer driven.
If you want to enable IDFA, please specify the IDFA fetching logic by passing it into adSupportBlock
.
amplitude.adSupportBlock = ^{
return [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
};
Add dependency
You need to add AdSupport.framework
to your project.


Android
The advertising ID is a unique, user-resettable ID for advertising, provided by Google Play services. Amplitude's Android SDK can help you track it, but you will need to install the required dependency and do proper configurations.
Add dependency
Please make sure you have play-services-ads
as a dependency.
dependencies {
implementation 'com.google.android.gms:play-services-ads:18.3.0'
}
AD_MANAGER_APP
If you use Google Mobile Ads SDK version 17.0.0 above. You need to add AD_MANAGER_APP to your AndroidManifest.xml
file.
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
</application>
</manifest>
Add Proguard exception
Amplitude Android SDK uses Java Reflection
technique to find some classes in Google Play Services. So to make Amplitude SDKs working properly in your Android application, please add these exceptions to proguard.pro for the classes from play-services-ads
.
-keep class com.google.android.gms.ads.** { *; }
Updated 2 months ago