Getting advertising IDs

An advertising ID is a unique Google Play service identifier for displaying ads to users who agree to see personalized ads. The user can disable the personalization of ads or reset the ID in settings. In this case, advertising networks won't be able to use it to select relevant ads. The accuracy of traffic attribution will also decrease significantly.

  1. Integrating a library for getting advertising IDs
  2. Setting up permissions to use advertising IDs

Integrating a library for getting advertising IDs

To get advertising IDs, the AppMetrica SDK uses a separate library: This library contains a dependency on, which is used to get the GAID. The library version must match the library version.


A dependency on the library is added by default.

Excluding the library of advertising IDs from the list of dependencies

If you don't want to get advertising IDs (for example, for children's apps), exclude the library by changing the method for connecting in the build.gradle file of the project:

dependencies {
   implementation ("$appmetricaVersion") {
       exclude group: '', module: 'mobmetricalib-identifiers' 

Setting up permissions to use advertising IDs

Starting from version 4.1.1, a new permission has been added to the AppMetrica SDK It is written in the AndroidManifest.xml library file. Therefore, you don't need to additionally specify it in the main manifest of the app. The permission allows you to use an advertising ID to select relevant ads from advertising networks.

If necessary, you can delete the permission. For example, if some policies, like the Families Policy, do not allow the use of an identifier for ad selection.

To prevent the permission from appearing in the main application manifest, add the following line to the AndroidManifest.xml file:

<uses-permission android:name="