---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.1
alternate:
  - https://yandex.com/support/metrica/en/code/html-markup.md
  - https://yandex.com/support/metrica/es/code/html-markup.md
  - https://yandex.com/support/metrica/pt/code/html-markup.md
  - https://yandex.com/support/metrica/ru/code/html-markup.md
  - https://yandex.com/support/metrica/tr/code/html-markup.md
  - https://yandex.com/support/metrica/zh/code/html-markup.md
  - href: zh/code/html-markup.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
title: 设置数据收集
description: Yandex Metrica 允许您使用 HTML 标记来控制某些类型的收集数据。 Yandex Metrica 计数器的 JavaScript 代码会对 HTML 元素类的存在作出反应。 除非另有指定，否则将为元素本身及其所有子元素触发为类定义的规则。
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/support/metrica/zh/llms.txt


# 设置数据收集

Yandex Metrica 允许您使用 HTML 标记来控制某些类型的收集数据。 Yandex Metrica 计数器的 JavaScript 代码会对 HTML 元素类（[class](http://www.w3schools.com/tags/att_global_class.asp) 属性）的存在作出反应。 除非另有指定，否则将为元素本身及其所有子元素触发为类定义的规则。


#|

||
**类**
|
**操作**
||
||
`ym-disable-clickmap`
|
禁用点击跟踪。

有关这些元素的点击信息不会被收集，也不会显示在 链接热图中

**单个元素**

 
:   ```xml 
    <a href="/forum/" class="ym-disable-clickmap">Forum</a>
    ```

**容器元素**

 
:   ```xml 
    <ul class="ym-disable-clickmap">
     <li><a href="/events/">Events</a></li>
     <li><a href="/specials/">Best deals</a></li>
     <li><a href="/contacts/">联系方式</a></li>
    </ul> 
    ```

**整个页面**

 
:   ```xml 
    <body class="ym-disable-clickmap">
     ...
    </body> 
    ```
||
||
`ym-disable-tracklink`
|
表示该链接不是外部链接。


```xml
<a href="/top-secret/" class="ym-disable-tracklink">Secret</a> 
```
||
||
`ym-disable-submit`
|
禁用跟踪表单数据提交事件。

有关提交的表单数据的信息不会显示在 Session Replay 和 Form analysis 工具中。
||
||
`ym-disable-keys`
|
禁用记录字段中输入的数据。 将此类用于 [textarea](https://www.w3schools.com/TAGS/tag_textarea.asp) 和 [input](https://www.w3schools.com/TAGS/tag_input.asp) 元素。

有关已填写字段的信息不会显示在 [用户行为回放](https://yandex.com/support/metrica/zh/webvisor/settings.md) 和表单分析工具中。
||
||
`ym-hide-content`
|
禁用用户界面元素的记录。 仅适用于 [Session Replay](https://yandex.com/support/metrica/zh/webvisor/settings.md)。
||
||
`ym-show-content`
|
启用任意站点元素的记录。 仅适用于 Session Replay。
||
||
`ym-record-keys`
|
启用字段内容的记录。 仅适用于 Session Replay。 将此类用于 [textarea](https://www.w3schools.com/TAGS/tag_textarea.asp) 和 [input](https://www.w3schools.com/TAGS/tag_input.asp) 元素。
||
||
`ym-external-link`
|
表明该链接是出站链接。

```xml
<a href="/forum/" class="ym-external-link">论坛</a>
```
||
|#

<!-- source: zh/_includes/buttons/chat-button.md -->
[与我们聊天](https://yandex.com/chat/#/user/036e6a02-3620-9cdc-4c5e-a34667a7379e?utm_source=spravka){.button}

<!-- source: zh/_includes/styles/href-to-button.md -->

<!-- endsource: zh/_includes/styles/href-to-button.md -->
<!-- endsource: zh/_includes/buttons/chat-button.md -->

<!-- source: zh/_includes/common/feedback7630.md -->
<div class="cut-button">

{% cut "发送电子邮件" %}

<!-- source: zh/_includes/popup/id-popup/wrong-sup.md -->
请注意：我们的支持团队永远不会主动给您打电话。 请勿按照自称为 Yandex Metrica 支持团队来电者的指示操作。
<!-- endsource: zh/_includes/popup/id-popup/wrong-sup.md -->

  <div style="padding: 15px;
       margin: 10px 0;
       background: #FFFFFF;
       border-radius: 10px;
       border: 1px solid var(--g-color-line-generic);">
    <iframe style="background: #FFFFFF;"
          height="700"
          width="100%"
          frameborder="0"
          src="https://forms.yandex.com/surveys/7630/?&iframe=1&lang=en">
    </iframe>
  </div> 

{% endcut %}

</div>

<!-- source: zh/_includes/styles/cut-button.md -->

<!-- endsource: zh/_includes/styles/cut-button.md -->
<!-- endsource: zh/_includes/common/feedback7630.md -->


[联系我们](https://yandex-ad.cn/contact){.button}


<!-- source: zh/_includes/footer-links.md -->
- - -

<div class="borderless-table">

#|
||
实用链接

- [演示计数器](https://metrica.yandex.com/r/dashboard?)
- [添加计数器](https://metrica.yandex.com/add/)
- [免费计数器设置](https://yandex.com/promo/freeservice/metrica?utm_source=help_metrica_en&utm_medium=cpc&utm_campaign=1)
- [Yandex Metrica API](https://tech.yandex.com/metrika/)
- [提出您的想法](https://yandex.com/support/metrica/troubleshooting/idea.html)
|
线上培训



- [参加培训课程](https://yandex.com/adv/edu/online/metrika?utm_source=metrika_help&utm_medium=web&utm_campaign=static&utm_content=useful_links)

||
|#

</div>

<!-- source: zh/_includes/styles/table-style.md -->

<!-- endsource: zh/_includes/styles/table-style.md -->
<!-- endsource: zh/_includes/footer-links.md -->

<!-- source: zh/_includes/styles/href-to-button.md -->

<!-- endsource: zh/_includes/styles/href-to-button.md -->

<!-- source: zh/_includes/styles/cut-button.md -->

<!-- endsource: zh/_includes/styles/cut-button.md -->
