# 合作伙伴发布者标签实施

Publisher Tag 是一段 JavaScript 代码片段，可自动将直接的品牌链接转换为追踪链接，捕获展示数据，并在使用 Trackonomics Essentials 时支持页面级报告。

根据你的具体设置和附加组件，该标签提供四项主要功能：

| 功能             | 描述                                                                                                                                                         | 要求                                                                                                                                                                                       |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 链接转换           | 自动将品牌链接转换为追踪链接。使用 *Trackonomics Essentials*时，此功能可扩展到你已连接的任何网络。                                                                                             | <ul><li><a href="#install-the-publisher-tag-with-a-basic-integration">基础集成</a></li><li>有条件地， <a href="https://impact.com/trackonomics-essentials/">Trackonomics Essentials</a></li></ul> |
| 展示跟踪           | 通过跟踪链接被查看的频率来衡量链接可见度。                                                                                                                                      | <ul><li><a href="#install-the-publisher-tag-with-a-basic-integration">基础集成</a></li><li>品牌侧激活</li></ul>                                                                                   |
| 页面级跟踪          | 通过 [*Story 概览*](/partner/zh/nin-xiang-liao-jie-shen-me/platform-features/trackonomics/trackonomics-reports/overview-by-story-report.md) 报告，为特定页面提供精细的收入数据。 | <ul><li><a href="https://impact.com/trackonomics-essentials/">Trackonomics Essentials</a></li><li><a href="#install-the-publisher-tag-with-a-basic-integration">基础集成</a></li></ul>       |
| `identifyUser` | 捕获高级流量数据，以便更精确地报告转化路径。                                                                                                                                     | [`identifyUser` 实施](#install-the-publisher-tag-with-identifyuser)                                                                                                                        |

#### Publisher tag 放置位置

根据你希望如何使用 Publisher Tag，它可以放置在：

* 在 `<head>` 标签中—— <mark style="color:$success;">**\[推荐]**</mark> 将代码放在 `<head>` 的底部。
* 在 `<body>` 网页的标签中——将代码放在 `<body>` 的底部。
* 在 **头部模板** 中—— <mark style="color:$success;">**\[推荐]**</mark> 将代码放在你的 **头部模板** 底部，如果你希望它自动在所有网页上运行。

#### 复制 Publisher Tag

1. 在顶部导航栏中，选择 **内容 →** [广告工具](https://app.impact.com/secure/mediapartner/fr/ads/mp-ad-tools-flow.ihtml).
2. 在 *Publisher Tag* 部分，在代码片段下方，选择 **复制标签** 即可将代码复制到剪贴板。

   <div data-with-frame="true"><figure><img src="/files/13fcc90d2e57ebe56dc8d8a0ac9f0ef5ffb229b5" alt=""><figcaption></figcaption></figure></div>

#### 使用基础集成安装 Publisher Tag

安装 Publisher Tag 的过程会因你的网站是本地托管、CMS 托管，还是使用标签管理器而有所不同。

{% tabs %}
{% tab title="本地托管" %}
如果你直接管理网站代码，而不是将其托管在 CMS 或网站平台上，请使用此方法。

1. 打开你希望安装 Publisher Tag 的网页源代码。
2. 在网页代码中，找到顶部的 `<head>` 起始标签。
3. 将完整的 Publisher tag 代码粘贴到该部分末尾，确保所有内容都位于 `</head>` 结束标签之前。
4. 对你希望 Publisher Tag 运行的每个网页重复此操作。
   {% endtab %}

{% tab title="CMS 托管" %}
如果你使用内容管理系统（CMS）或 WordPress、Squarespace、Wix 等第三方网站平台，请查阅其帮助文档，了解如何向网站添加 JavaScript 标签。快速进行网络搜索通常可以找到有关如何为特定 CMS 安装 JavaScript 标签的结果。示例如下：

* [WordPress：Header and Footer Scripts 插件](https://wordpress.org/plugins/header-and-footer-scripts/) &#x20;
* [Squarespace：使用 Code Injection](https://support.squarespace.com/hc/en-us/articles/205815908) &#x20;
* [Wix：关于跟踪工具和分析](https://support.wix.com/en/article/about-tracking-tools-analytics)
  {% endtab %}

{% tab title="标签管理器" %}
如果你的网站使用标签管理系统（TMS），你需要向网站添加自定义 HTML 标签。请参考标签管理器的帮助文档了解操作方法。例如：

* [Google Tag Manager — 自定义标签](https://support.google.com/tagmanager/answer/6107167?hl=en\&ref_topic=3002579)
  {% endtab %}
  {% endtabs %}

#### 测试你的基础集成

在你的网站上安装 Publisher Tag 代码片段后，应进行测试以确保其正常工作。使用浏览器的开发者控制台检查链接转换和展示跟踪功能是否正常。

<details>

<summary>检查你的网站链接 </summary>

1. 将鼠标悬停在链接上以打开浏览器开发者控制台，然后右键单击并选择 **检查** （或 **检查元素**).
   * 确认 `<a href=””>` 引号中的链接看起来像一个 impact.com 跟踪链接（例如， `https://advertiser.sjv.io/` ).
2. 或者，将鼠标悬停在网页上的链接上。大多数浏览器会在左下角的浏览器状态栏中显示链接路径。该链接应看起来像一个 impact.com 跟踪链接（例如， `https://advertiser.sjv.io/` 或类似形式）。

</details>

<details>

<summary>检查展示跟踪 </summary>

{% hint style="info" %}
**注意：** 如果你使用 Safari，请确保从顶部菜单启用 *状态* 栏。选择 **显示 → 显示状态栏** （或者在键盘上按住 ![](/files/6f9091e76fede6db6c33797744cef1ff7b99dffd) **\[Command] +** **/ \[斜杠键]**).
{% endhint %}

1. 将鼠标悬停在链接上以打开浏览器开发者控制台，然后右键单击并选择 **检查** （或 **检查元素**).
2. 在浏览器的开发者控制台中，选择 **Network** 选项卡。刷新页面以捕获最新数据。
   * 在 *Type*下方列表中，检查是否有 `xhr` 或 `beacon` 触发，状态为 `200`.
3. 或者，你也可以在 **Partner ID** 中搜索 *Network* 选项卡。该条目的格式为 `{trackingdomain}/i/partnerId/adId/campaignId` ，并且 `xhr` 或 `beacon` Type 和 Status 为 `200`.

</details>

#### 使用 identifyUser 安装 Publisher Tag

{% hint style="warning" %}
**注意！** 高级集成需要一位熟练的网页开发者，了解此集成如何更改脚本，以及该函数带来的影响。我们 **强烈建议** 在尝试此集成之前先咨询开发者。
{% endhint %}

使用 `identifyUser` 进行集成是推荐的方法，因为通过 `identifyUser` 提交经过身份验证的用户数据可帮助提升归因效果。

该 `identifyUser` 函数还会捕获非个人身份信息（non-PII）。

{% stepper %}
{% step %}

#### **步骤 1：修改脚本**&#x20;

1. 在其他函数调用之前，将以下代码行添加到 Publisher Tag 的主体中：

   ```programlisting
   impactPublisher('identifyUser', {properties}, {options});
   ```
2. 添加新代码后，完整标签将类似如下：

   ```programlisting
   <script type="text/javascript">
       (function(a,b,c,d,e,f,g){e['ire_o'] = c;e[c] = e[c] || function(){(e[c].a = e[c].a||[]).push(arguments)};f = d.createElement(b);g = d.getElementsByTagName(b)[0];f.async = 1;f.src = a;g.parentNode.insertBefore(f,g);})('//d.impactradius-event.com/<UNIQUE_ID>.js','script','impactPublisher',document,window);
       impactPublisher('identifyUser', {properties}, {options});
       impactPublisher('transformLinks', {properties}, {options [augmentLinksOnly, addImpressions]});
       impactPublisher('trackImpression', {properties}, {options});
       impactPublisher('trackLinks');
   </script>
   ```

{% endstep %}

{% step %}

#### **步骤 2：安装脚本**&#x20;

修改脚本后，你可以按照 [基础集成说明](#install-the-publisher-tag-with-a-basic-integration) 来安装脚本。
{% endstep %}

{% step %}

#### **步骤 3：测试你的 identifyUser 集成**&#x20;

在你的网站上安装 Publisher Tag 代码片段后，应进行测试以确保其正常工作。测试高级集成需要了解如何动态传递 `partnercustid` 或 `customeremail` 变量。

配置完成后，请在浏览器开发者控制台的 *Network* 选项卡中检查 `partnercustid={passedid}` 和 `customeremail={passedemail}`.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**注意：** 有关 Publisher Tag 的更多信息，请阅读 [Publisher Tag 常见问题](/brand/zh/nin-xiang-liao-jie-shen-me/platform-features/tracking/tracking-explained/publisher-tag-faq.md)。如果你不确定如何完成本文中提到的任何步骤， [联系支持](https://app.impact.com/support/portal.ihtml?createTicket=true).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.impact.com/partner/zh/nin-xiang-liao-jie-shen-me/platform-features/tracking/tracking-links/create-and-manage-links/publisher-tag-implementation-for-partners.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
