How to retrieve Advertising ID in Vega

Advertising ID (Ad ID) is commonly used in various apps, especially in AVOD (Advertising Video On Demand) apps. Ad ID is used to show customized ads for specific customers and/or devices. Given Ad ID is used for privacy related features, it is important to provide opt-out mechanism for end users. In this KB, we will explain how to retrieve an Ad ID and opt-out status on Vega. We will also explain conditions for testing AdIdRetriever on Vega FTV devices.

:exclamation: AdIdRetriever is ONLY supported on the Vega FTV device. If you try to run this on the Vega Virtual Device, AdIdRetriever.isAdvertisingTrackingEnabled() always returns false.

Steps to integrate

  1. Add the following library in the "dependencies" section to package.json.

"dependencies": {

"@amazon-devices/kepler-adid-retriever": "~1.0.14"

}

  1. Add Package ID to manifest.toml.

[wants]

[[wants.service]]

id = "com.amazon.admanager.service.main"

  1. Import AdIdRetriever in your code.

import {AdIdRetriever} from '@amazon-devices/kepler-adid-retriever';

  1. Retrieve AdID in your code. Note that fetchAdvertisingId() returns the advertising ID regardless of tracking state, but per Amazon’s advertising policy, you should only use it for interest-based ads when tracking is enabled.

if (AdIdRetriever.isAdvertisingTrackingEnabled()) {

const adId: string = AdIdRetriever.fetchAdvertisingId();

console.log(`Interest-based Ads is enabled. Retrieved AdID: ${adId}`);

} else {

console.log(`Interest-based Ads is disabled.`);

}

  1. Build and run your project. With the sample code above, you’ll see the console.log messages using loggingctl (see details in Use Loggingctl to Manage System Logs | Vega CLI Tools)

Testing Conditions

  1. Go to Settings > Preferences > Privacy Settings > Interest-based Ads. Change it On or Off to test AdIdRetriever.isAdvertisingTrackingEnabled()

  2. Check the Ad ID under the Privacy Settings to test AdIdRetriever.fetchAdvertisingId()

  3. You can also reset Ad ID on the Ad ID setting.

Last updated: Mar 9, 2026

1 Like