---
metadata:
  - name: generator
    content: Diplodoc Platform v5.66.1
alternate:
  - https://ads.yandex.com/helpcenter/en/monetization/adfox/banner-specs/media-native-deeplink.md
  - https://ads.yandex.com/helpcenter/ru/monetization/adfox/banner-specs/media-native-deeplink.md
  - https://ads.yandex.com/helpcenter/zh/monetization/adfox/banner-specs/media-native-deeplink.md
  - href: https://ads.yandex.com/helpcenter/zh/monetization/adfox/banner-specs/media-native-deeplink.md
    type: text/markdown
    title: Markdown version
  - href: https://ads.yandex.com/helpcenter/zh/llms.txt?revision=r22039017
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/zh/llms.txt?revision=r22039017

# Media Native Deeplink

**Media Native Deeplink** 是适用于图像广告素材的模板，可以与您的应用设计无缝集成。使用此模板，您可以设置指向应用中特定页面的链接（深层链接）。

Media Native Deeplink 广告示例：

![](../../_images/media-native-deeplink.gif =450x)

## 创建原生横幅 {#customize}

<!-- source: zh/monetization/_includes/adfox-native.md -->
1. 确定要在横幅中包含哪些原生广告元素。
1. 准备 JSON 代码。在代码中指定要自定义的参数（广告元素及其值）。

   {% cut "JSON 示例" %}

   ```json
   {
     "content": [
       "text",
       "button"
     ],
     "text": {
       "value": "Customizable text from an Adfox ad unit"
     },
     "button": {
       "label": "Custom button",
       "link": "https://ya.ru/",
       "backgroundColor": "#5D9B9B"
     }
   }
   ```

   {% endcut %}

   要传递横幅广告 JSON 元素的点击跳转 URL，请使用宏：`%banner.reference_mrc_user1%`。系统将统计横幅广告点击次数，并将用户重定向到 **Transition URL** 参数中指定的广告主网站。

1. 将 JSON 代码写成一行，并使用 `\` 字符转义引号。

   {% cut "带转义引号的 JSON 示例" %}

   ```json
   {   \"content\": [     \"text\",     \"button\"   ],   \"text\": {     \"value\": \"Customizable text from an Adfox ad unit\"   },   \"button\": {     \"label\": \"Custom button\",     \"link\": \"https:\/\/ya.ru\/\",     \"backgroundColor\": \"#5D9B9B\"   }
   ```

   {% endcut %}

1. 为了确保在应用中正确显示原生元素，请在应用端添加对读取 JSON 数据的支持。请注意，JSON 中指定的每个原生广告元素都必须在应用代码中正确实现。

   {% cut "解析 JSON 数据的示例 (Kotlin)" %}

   ```kotlin

   private fun processAdditionalText(rawJson: String) {
       try {
           val jsonObject = JSONObject(rawJson)
           val contentJSONArray = jsonObject.getJSONArray("content")

           repeat(contentJSONArray.length()) { index ->
               val elementName = contentJSONArray.getString(index)
               val elementConfiguration = jsonObject.getJSONObject(elementName)

               when (elementName) {
                   "text" -> addTextToLayout(elementConfiguration, index)
                   "button" -> addButtonToLayout(elementConfiguration, index)
               }
           }
       } catch (e: JSONException) {
           adInfoFragment.log(e.message ?: "JSON parsing error")
       }
   }

   private fun addTextToLayout(textConfiguration: JSONObject, index: Int) {
       val textView = TextView(this).apply {
           setPadding(resources.getDimension(R.dimen.item_padding).toInt())

           text = textConfiguration.getString("value")
       }
       additionalContainer.addView(textView, index)
   }

   private fun addButtonToLayout(buttonConfiguration: JSONObject, index: Int) {
       val buttonView = Button(this).apply {
           setPadding(resources.getDimension(R.dimen.item_padding).toInt())

           text = buttonConfiguration.getString("label")

           val colorHex = buttonConfiguration.getString("backgroundColor")
           setBackgroundColor(Color.parseColor(colorHex))

           setOnClickListener {
               val link = buttonConfiguration.getString("link")
               val intent = Intent(Intent.ACTION_VIEW, Uri.parse(link))
               startActivity(intent)
           }
       }
       additionalContainer.addView(buttonView, index)
   }

   ```
   {% endcut %}

1. 按照[以下说明](#add-banner)添加横幅。

{% cut "原生横幅广告准备阶段"%}

![](../../_images/adfox-additional-json.png)

{% endcut %}
<!-- endsource: zh/monetization/_includes/adfox-native.md -->

## 将横幅添加到 Adfox {#add-banner}

1. 在广告系列设置中，转到 **Banners** 选项卡并点击 **Add**。
1. 选择 **App Mobile Native** 横幅类型和 **Media Native Deeplink** 模板。
1. 设置横幅参数：

   {% list tabs %}

   - 主要

      * **Priority**：决定广告系列中横幅显示顺序的数字。数值越高，该横幅相对于同一广告系列中其他横幅的优先级就越高。要了解有关优先级的更多信息，请参见 [Adfox 帮助](https://yandex.com/support2/adfox/en/campaigns/rotation-method)。

      * **Click-through web URL**：如果用户尚未安装深层链接重定向到的应用，则会调用此链接。

      * **Image URL (URL)** 或 **Image URL (File)**：上传图片。

      * **Width**：设置横幅宽度（输入以像素为单位的整数，而不指定尺寸）。

      * **Height**：设置横幅高度（输入以像素为单位的整数，而不指定尺寸）。

      * **Additional text**：如果您需要向广告或广告素材添加自定义元素，请指定[您之前创建的 JSON](#customize)。

         {% cut "已填写的 **Additional text** 的示例" %} 字段

         ![](../../_images/adfox-additional-text.png)

         {% endcut %}

      * **Android BundleID**：Google Play 中的应用 ID。要在 Android 设备上启用深层链接，需要提供此参数。例如，`ru.yandex.searchplugin`。

      * **Deeplink click-through URL**：将用户重定向到 iOS 或 Android 应用中的特定页面的链接。

         {% note alert %}

         如果不同操作系统的应用使用不同的寻址（对象 ID 不同），请为每个应用创建一个具有自己的深度链接的单独横幅。

         为了更轻松地管理版位，请将每个应用添加为 Adfox 中的单独对象（网站、版块或站点）。

         {% endnote %}

      * **Start date and time**：必需参数。默认情况下，此参数设置为当前日期。如果您不做更改，横幅将在添加后立即开始投放（如果其状态设置为 **active**）。

      <!-- source: zh/monetization/_includes/banner-labeling.md -->
      * **Ad label**：选择 **Ad** 或 **Social Ad** 以在横幅广告中添加标签。如果您的广告素材已包含标签，则可以在下拉列表中保留 **Disabled** 值。

         {% note info %}

         添加 **Social Ad** 标签并不会自动将广告素材定义为社交广告。要将广告素材在国家注册中标记为社交广告，请在相应的[与最终广告主签订的合同](https://yandex.com/support2/adfox/en/labeling/token#step-2) 中选择 **Social ads contract**。

         {% endnote %}

      * **Domain**：指定广告主域名并将其添加到标签中：`Ad / Example.com` 或 `Social ad / Example.com`（仅当在下拉列表中选择了 **Ad** 或 **Social Ad** 值时）。
      * **Show banner menu**：启用此选项可将令牌添加到不可点击的横幅中。横幅广告投放时，菜单图标将显示在其右上角。点击此图标将显示有关广告主的信息，并提供复制令牌的按钮（如果您为该横幅广告启用了标签或指定了第三方令牌）。

         横幅菜单包含指向使用推荐技术的规则的链接。这是为了遵守《第 149-FZ 号联邦法》第 10.2–2 条 第 1 节第 3 款的规定，该法律于 2006 年 7 月 27 日颁布，涉及信息、信息技术和信息保护。

         {% note info %}

         如果横幅广告需要标记，您可以启用横幅菜单，以便在广告投放给用户时确保令牌可用。

         {% endnote %}

      * **Settings for Russian ad register**：仅当您在广告系列设置中选择了 **Advertising labeling** 作为标记程序时，此部分才可用。填写此部分中的字段，以在 Yandex 广告数据运营商中注册广告素材。广告素材会自动分配一个令牌。有关标记广告的更多信息，请参阅 [Adfox 帮助](https://yandex.com/support2/adfox/en/labeling/about)。
      <!-- endsource: zh/monetization/_includes/banner-labeling.md -->

   - 附加

      <!-- source: zh/monetization/_includes/banner-additional.md -->
      * **Name**：输入横幅的名称。如果将此字段留空，则会为其分配一个序列号。

      * **Status**：选择横幅的状态：
         * **active**：横幅已准备好投放。
         * **paused**：横幅展示已暂停。
         * **completed**：横幅将不会被投放。

      * **Disabled on new placements**：此选项默认启用。创建横幅后，它不会自动放置在以下位置：
         * 在您的广告l系列所在的网站或部分中创建的新版位中。
         * 在创建横幅后在广告系列版位设置中启用的版位中。
      如果您禁用此选项，横幅将自动添加到启用了广告系列版位的任意版位中。

      * **Targeting profile**：选择您之前创建的定位配置文件。要了解有关定位配置文件的更多信息，请参见 [Adfox 帮助](https://yandex.com/support2/adfox/en/settings/profiles)。

      * **Events enabled**：此选项用于获取要在第三方系统中跟踪的事件的直接链接。
         要激活该选项，请在 **Placements** 选项卡中点击横幅旁边的 ![](../../_images/code.png)。在打开的窗口中，您将看到事件 1 到 30 的链接。将其复制并发送到第三方系统以进行跟踪。

      * **Impressions total, day, hour**：

         * **Impressions total, day, hour**：横幅展示的最大次数。如果广告系列分布均匀，请设置横幅显示结束日期。一旦展示次数达到最大值，横幅的状态就会更改为 **completed** 并且不再投放。
         * **Impressions per day**：每天的最大展示次数。一旦从当天开始的展示次数达到最大值，展示就会暂停，直到第二天开始。
         * **Impressions per hour**：每小时的最大展示次数。一旦从一小时开始的展示次数达到最大值，展示就会暂停，直到下一小时开始。

      * **Clicks total, per day, per hour**：

         * **Clicks total**：横幅点击的最大次数。如果广告系列分布均匀，请设置横幅显示结束日期。  一旦点击次数达到最大值，横幅的状态将更改为 **Completed** 并且不再投放。
         * **Clicks per day**：每天的最大横幅点击次数。一旦从当天开始的点击次数达到最大值，展示就会暂停，直到第二天开始。
         * **Clicks per hour**：每小时的最大横幅点击次数。一旦从一小时开始的点击次数达到最大值，展示就会暂停，直到下一小时开始。

      * **End time**：要设置结束日期和时间，请首先启用该选项。
      <!-- endsource: zh/monetization/_includes/banner-additional.md -->

   {% endlist %}

1. 要保存横幅，请点击 **Add**。

<!-- source: zh/monetization/_includes/support.md -->
[联系支持部门](https://ads.yandex.com/helpcenter/zh/support/contact.md){.button}


<!-- endsource: zh/monetization/_includes/support.md -->

