SDK Version Selection
Choose your SDK version below:
- Apptrove SDK → Recommended for all projects (Latest: v2.0.0)
- Trackier SDK → Will be deprecated in May 2026 (v1.x.xx)
Use the tabs below to view Apple Update Token code for your chosen SDK.
Apple Update Token
The Apple Update Token allows you to update Apple's Ads Attribution token for enhanced tracking on iOS devices in React Native applications.
What is Apple Update Token?
Apple's Ads Attribution token helps maintain user attribution across app updates and reinstalls, ensuring continuous tracking and data continuity.
Library Reference
react-native-attribution-token
React Native module for fetching attribution token on iOS.
Requirements:
- AdServices framework (iOS)
Documentation:
getAttributionToken()- Fetches the attribution token from the AdServices framework on iOS. Returns a promise that resolves to the attribution token.- On Android, this method will return a promise that resolves to null.
Repository: react-native-attribution-token
Installation
First, install the react-native-attribution-token library to get the Apple Ads token:
npm install react-native-attribution-token
Usage:
import { getAttributionToken } from 'react-native-attribution-token';
const getToken = async () => {
try {
const token = await getAttributionToken();
console.log(token);
} catch (error) {
console.log(error);
}
};
Complete Example with SDK Initialization
- ✓ Apptrove SDK (Recommended)
- Trackier SDK (Deprecating May 2026)
import React, { useEffect } from 'react';
import { ApptroveSDK, ApptroveConfig } from 'react-native-apptrove';
import { getAttributionToken } from 'react-native-attribution-token';
const App = () => {
const getAppleAdsToken = async () => {
try {
const token = await getAttributionToken();
return token;
} catch (error) {
console.log('Error getting Apple Ads token:', error);
return null;
}
};
useEffect(() => {
const initializeSDK = async () => {
const appleAdsToken = await getAppleAdsToken();
if (appleAdsToken) {
ApptroveSDK.updateAppleAdsToken(appleAdsToken);
}
const config = new ApptroveConfig('YOUR_APP_TOKEN', 'production');
ApptroveSDK.initialize(config);
};
initializeSDK();
}, []);
return (/* Your app component */);
};
import React, { useEffect } from 'react';
import { TrackierSDK, TrackierConfig } from 'react-native-trackier';
import { getAttributionToken } from 'react-native-attribution-token';
const App = () => {
const getAppleAdsToken = async () => {
try {
const token = await getAttributionToken();
return token;
} catch (error) {
console.log('Error getting Apple Ads token:', error);
return null;
}
};
useEffect(() => {
const initializeSDK = async () => {
const appleAdsToken = await getAppleAdsToken();
if (appleAdsToken) {
TrackierSDK.updateAppleAdsToken(appleAdsToken);
}
const config = new TrackierConfig('YOUR_APP_TOKEN', 'production');
TrackierSDK.initialize(config);
};
initializeSDK();
}, []);
return (/* Your app component */);
};
Function Reference
| Method | Description | Parameters | Returns |
|---|---|---|---|
updateAppleAdsToken(token) | Update Apple Ads token | String | void |
Where to Add
- App Launch: Update token when your app starts
- Token Refresh: Update when you receive a new token from your server
- Deep Link Handling: Update token before processing deep links
Best Practices
- Validate Token: Ensure token is not empty and has proper format
- Error Handling: Wrap in try-catch for network errors
- Storage: Store token securely for future use
- Platform Check: Only call on iOS devices
- Async Handling: Use async/await for token retrieval
Support
For issues with Apple Update Token implementation, refer to our Support page.