as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
Ring
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
跳转到主要内容
Ad ID Retriever是一项设备上的服务,用于检索广告ID和广告跟踪状态。 使用案例:
  • 检索应用广告ID,用于竞价、报告曝光量和报告广告归因。(fetchAdvertisingId)
  • 检索用户对基于兴趣的广告偏好。(isAdvertisingTrackingEnabled)

行为

  • Verify tracking before you use the advertising ID. Call isAdvertisingTrackingEnabled and check the result before you use the value from fetchAdvertisingId for interest-based advertising. If it returns false, the user has opted out of interest-based advertising, so serve contextual (non-personalized) advertisements rather than interest-based ones.
  • Child profiles. On a child profile, isAdvertisingTrackingEnabled returns false regardless of the Interest-based Ads setting. The user has opted out of interest-based advertising, so serve contextual (non-personalized) advertisements rather than interest-based ones.
  • Service unavailable. fetchAdvertisingId returns an empty string if it cannot reach the Advertising Manager service. This does not raise an error. An empty string means the Advertising Manager service was unreachable. Do not use an empty string as a valid advertising ID.

开始使用

设置

  1. 将以下库依赖项添加到package.json文件的dependencies部分。
  1. 在您的manifest.toml中,添加访问Ad ID Retriever所需的以下权限。

用法

此示例演示如何实现Ad ID Retriever服务。该示例提供了一个带有两个按钮的简单用户界面,这些按钮展示了两个核心功能:获取广告ID和检查广告跟踪状态。

API参考

类

  • AdIdRetriever—AdIdRetriever提供用于检索广告ID和广告跟踪状态的API。

最后修改于 2026年10月26日