Accounting contextual data
Warning.
This is an archived version of the documentation. Actual documentation for all platforms can be found here.
Note. To make the Mobile Ads SDK take the app context into account, enable the AppMetrica SDK version 3.14.3 and higher.
Contextual data accounting is available as of August 20, 2020.
To make monetization more effective, the Mobile Ads SDK automatically takes into account the app context: interface texts, their topics, and how the user interacts with content. This results in selecting more relevant ads.
At the same time:
- You can restrict contextual data tracking, for example, in places where users enter confidential information: on payment screens or in personal correspondences.
- You can completely disable contextual data accounting.
- The SDK only takes into account depersonalized data and corresponds to the ISO standard.
Requirements for using the function
- The function is only available for Android.
- The minimum supported version of the AppMetrica SDK is 3.14.3 and higher.
- The minimum supported version of the Mobile Ads SDK is Android 2.160 and higher.
How to enable contextual data accounting
To enable automatic accounting of application context data, initialize the AppMetrica SDK library version 3.14.3 and higher.
How to disable contextual data accounting
You can disable automatic accounting for different entities: Application, Activity, or View:
To disable automatic accounting of contextual data for the entire app, in the AndroidManifest.xml file at the application level, add the following code:
<meta-data
android:name="@string/yandex_ads_context"
android:value="@string/yandex_ads_context_do_not_parse"/>
- Code example:
-
<application android:name="com.yandex.appmetrica.autotests.agent.AgentApplication" ...> <meta-data android:name="@string/yandex_ads_context" android:value="@string/yandex_ads_context_do_not_parse"/> </application>
To disable automatic accounting of contextual data for a specific activity, in the AndroidManifest.xml file at the activity level, add the following code:
<meta-data
android:name="@string/yandex_ads_context"
android:value="@string/yandex_ads_context_do_not_parse"/>
- Code example:
-
<activity android:name=".NoContextActivity" ...> <meta-data android:name="@string/yandex_ads_context" android:value="@string/yandex_ads_context_do_not_parse"/> </activity>
There are two ways to disable automatic accounting of contextual data for a particular view:
- In the Android resources of a project
-
<TextView ...> <tag android:id="@id/yandex_ads_context" android:value="@string/yandex_ads_context_do_not_parse"/> </TextView>
- Programmatically
-
view.setTag(R.id.yandex_ads_context, getString(R.string.yandex_ads_context_do_not_parse))