Skip to main content
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

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 */);
};

Function Reference

MethodDescriptionParametersReturns
updateAppleAdsToken(token)Update Apple Ads tokenStringvoid

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

  1. Validate Token: Ensure token is not empty and has proper format
  2. Error Handling: Wrap in try-catch for network errors
  3. Storage: Store token securely for future use
  4. Platform Check: Only call on iOS devices
  5. Async Handling: Use async/await for token retrieval

Support

For issues with Apple Update Token implementation, refer to our Support page.