---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/unity/target-adfox.md
  - https://ads.yandex.com/helpcenter/ru/dev/unity/target-adfox.md
  - https://ads.yandex.com/helpcenter/zh/dev/unity/target-adfox.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/zh/llms.txt

# Adfox 中的广告定位

<!-- source: zh/dev/_includes/target-adfox.md -->
在 Adfox 中，可以在[不同级别](*level)设置定位。 向请求中添加上下文数据可显著提升广告质量进而增加收入。

要使用[附加定位](https://yandex.com/support2/adfox/en/targeting/puid)、[逻辑定位](https://yandex.com/support2/adfox/en/targeting/logic) 或[关键词定位](https://yandex.com/support2/adfox/en/targeting/words) 进行直接销售，请将广告请求中的相关参数值传递到 Adfox。
<!-- endsource: zh/dev/_includes/target-adfox.md -->

<!-- source: zh/dev/_includes/target-adfox.md -->
## 设置定位 {#setup-adfox}

根据您的需求选择合适的定位类型，并实施传递相关参数值：

#|
|| **定位类型** | **参数名称** | **描述** ||
|| 关键词定位 | `adf_pk` | 根据所选关键词投放广告横幅。 例如，您可以在广告标记中插入搜索查询，或设置按名称和兴趣定位，使用用户群更精准地识别目标受众。

为此，请将值为 `adf_pk = value` 格式的参数插入到广告标签的 `params` 对象中，其中：

- `adf_pk` 是参数名称。
- `value` 是用单引号括起来的参数值。 参数值可包含：
   - 关键词：最多 10 个以空格分隔的关键词。
   - 短语：仅一个短语。

不区分大小写。 无需编码。

有关更多信息，请参阅 [Adfox 帮助](https://yandex.com/support2/adfox/en/targeting/words) ||
|| 附加和逻辑定位 | `adf_puidN` | 根据附加定位投放广告横幅。

您可以指定自定义定位值。 例如，您可以仅定位具有测试版本的用户或根据特定的内部指标触发横幅展示。

为此，请将广告请求中带有值 `adf_puidN = value` 的参数传递到 Adfox。

<!-- source: zh/dev/_includes/add-target-steps.md -->
{% cut "设置其他定位的步骤" %}

1. 为定位特征创建字典。该字典应包含值列表：

    - 键将传递给应用中的广告标记。

    - 值包含在定位设置中，并可进行切换。

    在 Adfox 中，您最多可为特征添加 63 个自定义字典。每个字典最多可容纳 10,000 个值，并可根据需要使用新的键值对进行更新。

1. 通过 Adfox 界面上传字典，以用于任意可用的额外定位特征。

1. 实施将键传递给您为其创建字典的特征的索引。

{% endcut %}
<!-- endsource: zh/dev/_includes/add-target-steps.md -->

要使用逻辑定位，请从应用中传递附加定位的值。 在 Adfox 界面中，您还可以使用 `AND/OR/NOT` 条件设置广告系列展示。

有关更多信息，请参阅 [Adfox 帮助](https://yandex.com/support2/adfox/en/targeting/puid) ||
|| 用于调试横幅的 ID | `adf_p1`：版位 ID。

`adf_pfc`：广告系列 ID。

`adf_pfb`：横幅 ID。 | 从特定广告版位或广告系列调用横幅。

{% note warning %}

建议仅出于测试目的调用特定横幅。 否则，广告版位不会显示其他横幅。

{% endnote %}

要调用特定横幅，请传递两个值：`adf_p1` 和 `adf_pfb`。 横幅、广告系列和广告版位 ID 可在 Adfox 界面中找到。 ||
|#
<!-- endsource: zh/dev/_includes/target-adfox.md -->

<!-- source: zh/dev/_includes/target-adfox.md -->
## 示例代码 (C#) {#examples-unity}

[//]: # (пример для Unity)

```c#
using YandexMobileAds.Base;

private Dictionary<string, string> CreateAdfoxParameters()
{
    return new Dictionary<string, string>
    {
        { "adf_puid1", "<XXX>" },
        { "adf_puid2", "<XXX>" },
        { "adf_pk", "<XXX>" },
        // ...
    };
}

private void RequestBanner()
{
    // ...
    AdRequest request = new AdRequest(
        adUnitId: "R-M-XXXXXX-X", // Replace R-M-XXXXXX-X with the actual R-M
        parameters: CreateAdfoxParameters());
    banner.LoadAd(request);
    // ...
}
```
<!-- endsource: zh/dev/_includes/target-adfox.md -->

[*level]: 定位的优先级从高到低依次为：
- 横幅。
- 平台广告版位。
- 版块广告版位。
- 网站广告版位。
- 广告系列。