Overview
TheAaidAliasProvider provides:
- Automatic AAID capture - No manual ID retrieval needed
- Persistent identification - User tracking across app sessions
- Privacy compliant - Respects user opt-out preferences
- Zero maintenance - Automatically updates when AAID changes
Prerequisites
- Google Ads add-on installed
- Google Play Services on device
- AD_ID permission (Android API 31+)
Installation
The AAID provider is included in the Google Ads add-on:Basic Setup
Add AaidAliasProvider at Initialization
Add theAaidAliasProvider when creating your Permutive instance:
Required Permissions (Android API 31+)
Add AD_ID Permission
From Android API 31 (Android 12) and later, theAD_ID permission is required to access the AAID.
Add this to your AndroidManifest.xml:
Checking Permission Status
The permission is automatically granted - no runtime permission request needed. However, users can opt out of ad tracking in their device settings.How It Works
Automatic ID Capture
WhenAaidAliasProvider is added:
- On initialization - AAID is retrieved from Google Play Services
- Async retrieval - ID fetched in background (non-blocking)
- Auto-set identity - AAID automatically set as user alias
- Tag created - Stored with tag
"aaid" - Persisted - AAID saved for future sessions
Alias Details
The AAID is stored as an alias with:- Tag:
"aaid" - Identity: The advertising ID (e.g.,
"38400000-8cf0-11bd-b23e-10b96e40000d") - Priority: 0 (default)
- Expiry: Never (unless manually cleared)
User Opt-Out Handling
If a user opts out of ad personalization in device settings:- The AAID provider will receive a zeroed-out ID
- This zeroed-out ID will not be set as an alias
- Permutive will use the default anonymous ID instead
Combining with Other Identities
You can use AAID alongside other identity methods:AAID + Custom Identity
- Custom identity:
"user_12345"(tag:"user_id") - AAID:
"38400000-8cf0-11bd-b23e-10b96e40000d"(tag:"aaid")
AAID + Multiple Custom Aliases
Verification
Verify AAID is Set
Enable debug logging to verify AAID is captured:Check Current Identities
You can programmatically check if AAID is set:Use Cases
Anonymous User Tracking
For apps without user login, AAID provides persistent tracking:Logged-In User + AAID
For apps with user accounts, combine both:Cross-Device Tracking
AAID is device-specific. For cross-device tracking, combine with email or other identifiers:Privacy Considerations
GDPR Compliance
AAID is considered personal data under GDPR. Ensure:- ✅ User consent obtained before initialization
- ✅ Privacy policy explains AAID usage
- ✅ User can opt out via device settings
- ✅ Data can be deleted on request
User Opt-Out
Users can opt out of ad personalization in:- Settings → Google → Ads → Opt out of Ads Personalization
- AAID is zeroed out (
00000000-0000-0000-0000-000000000000) AaidAliasProviderwill not set this as an identity- Permutive uses anonymous ID instead
Data Deletion
To clear all user data including AAID:- All identities (including AAID)
- All event data
- All cohort information
Troubleshooting
AAID Not Being Set
AAID Not Being Set
Problem: AAID not appearing in events.Causes:
- Google Ads add-on not installed
AaidAliasProvidernot added to Permutive- Missing
AD_IDpermission (Android 12+) - Google Play Services not available
- User opted out of ad personalization
- Verify
google-ads:2.2.0is in dependencies - Add
AaidAliasProvidertoaliasProviderslist - Add
AD_IDpermission to manifest (Android 12+) - Test on device with Google Play Services
- Check user’s ad personalization settings
- Enable debug logging to see AAID capture attempts
Permission Denied (Android 12+)
Permission Denied (Android 12+)
Problem: Error about AD_ID permission.Cause:
AD_ID permission not declared.Solution: Add to AndroidManifest.xml:Google Play Services Not Available
Google Play Services Not Available
Problem: AAID cannot be retrieved.Cause: Device doesn’t have Google Play Services (e.g., some devices in China).Solutions:
- Implement fallback identification method
- Use custom identity instead
- Check Play Services availability:
AAID Changes Unexpectedly
AAID Changes Unexpectedly
Problem: AAID changes unexpectedly.Causes:
- User reset advertising ID in settings
- Factory reset
- App reinstalled
Best Practices
- Do
- Don't
- Add
AaidAliasProviderat SDK initialization - Declare
AD_IDpermission for Android 12+ - Obtain user consent before capturing AAID (GDPR)
- Combine AAID with other identifiers for robustness
- Handle Google Play Services unavailability
- Respect user opt-out preferences
Related Documentation
Google Ad Manager
Use AAID with GAM
Identity Management
Multiple identities
Initialization
SDK setup
Verification
Verify AAID capture
Issues
Solve common issues
API Reference
For complete API documentation, see the Javadocs.AaidAliasProvider
AaidAliasProvider(context: Context)- Creates AAID alias provider
Usage in Permutive
Kotlin:Getting Help
If you encounter issues with AAID:- Check Troubleshooting Guide
- Verify Google Ads add-on is installed
- Confirm
AD_IDpermission is declared (Android 12+) - Enable debug logging
- Test on device with Google Play Services
- Contact your Customer Success Manager