Accounting contextual data
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 tracking was made available on 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 correspondence.
-
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 tracking of contextual app data, initialize version 3.14.3 or later of the AppMetrica SDK library.
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))