article

Nick Gardner avatar image
Nick Gardner posted

Using the Advertising ID in Your App

Summary:

The Advertising ID is a user-resettable, unique, random identifier for use in advertising and analytic purposes. It is currently available on Fire tablets running at least Fire OS 5.1. A user can reset the Advertising ID or opt out of tracking for interest-based ads altogether.

When to Use the Advertising ID You should use the Advertising ID if your app does the following:

  • Displays ads
  • Tracks the user's behavior for the purpose of displaying ads targeted to their interests

On any device that supports the Advertising ID, your app should use the Advertising ID over any other ID. If your app does not use ads, it should not retrieve the Advertising ID. Ensure that if you use a third-party ad service in your app, the service follows the requirements around the user's choice.

Developer Expectations We expect developers that use the Advertising ID to follow these principles:

  • Do not use the Advertising ID for anything but advertising and analytic purposes related to that advertising. Apps that do not display ads have no reason to retrieve the Advertising ID.
  • When the user opts out of interest-based ads, you must honor that choice. Do not collect information about the user's interests and do not show them targeted ads. In your code, any call to retrieve the Advertising ID must be preceded by a call that verifies the user's choice. If the user has opted-out of tracking, you must abandon the retrieval.
  • Do not include personally-identifiable information in the data gathered under the Advertising ID unless the user has explicitly given consent for you to include that information.
  • Do not associate the Advertising ID with a persistent device ID unless the user has explicitly given consent for you to do so.
 When a user resets the Advertising ID, do not fold earlier data into the new Advertising ID or associate the new ID with the old one unless the user has explicitly given consent for you to do so.

For more information, see the App Distribution and Services Agreement.

Verifying and Responding to the User's Advertising ID Choices in Your Code

The Android Settings.Secure class exposes the user's Advertising ID choices through the getInt and getString methods. The following Java example shows the logic for verifying the user setting, retrieving an Advertising ID (if permitted), and determining whether the user has reset the Advertising ID:

String advertisingID = "";
// Check whether this is an Amazon device
if (String("Amazon").equals(android.os.Build.MANUFACTURER))
{
    ContentResolver cr = getContentResolver();
    // Check whether the user has disabled tracking
    int limitAdTracking = Secure.getInt(cr, "limit_ad_tracking", 2);
    if (limitAdTracking == 0)
    {
        // Interest-based tracking is allowed, retrieve the Advertising ID
        advertisingID = Secure.getString(cr, "advertising_id");
    }
    else if (limitAdTracking == 2)
    {
        // This version of Fire OS does not have this setting; if an ID is needed, use an alternate source
    }
else { 
        // User tracking for ads is not allowed
    }
} 

Note that the Advertising ID returns a value of "00000000-0000-0000-0000-000000000000" in the case of a child profile.

KB_396

mobile ads
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Article

Contributors

brizzlebrazzle contributed to this article nick_gardner contributed to this article