# 如何禁用链接点击计数器？

**URL:** <https://meta.discourse.org/t/how-to-disable-link-click-counters/292791>\
**Category:** Development\
**Tags:** click-counter\
**Created:** [2024年一月24日 16:10 UTC](https://meta.discourse.org/t/how-to-disable-link-click-counters/292791 "2024-01-24T16:10:28Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![keegan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/keegan/32/383395_2.png) [@keegan](https://meta.discourse.org/u/keegan)\
**Post date:** [2024年十月31日 21:19 UTC](https://meta.discourse.org/t/how-to-disable-link-click-counters/292791/4 "2024-10-31T21:19:05Z")

</div>

@MarcP

我们更新了点击计数器的实现方式。现在有一些改进，例如复制文本不会拾取点击计数器编号。

您应该可以通过执行以下操作来隐藏点击计数器，并且它们之间不应留有任何空格。

```css
a[data-clicks]::after {
     display: none;
}

```

> <https://github.com/discourse/discourse/pull/29453>
>
> \## :mag: Overview
> Currently the tracking for clicked links are injected into th…e HTML in a span tag. This leads to the link counter value being highlighted when copying and pasting. Additionally, any means for using CSS to hide link counters result in a gap due to it occupying a specific width.
> 
> With this change, we make link counters appear in a data attribute on the link element and visually shown with CSS \`::after\` element.
> 
> \## 📸 Screenshots
> !\[Screenshot 2024-10-28 at 16 07 50\](https://github.com/user-attachments/assets/cf026631-688f-4dbb-94d3-93128f7fbeee)

---

_[View the full topic](https://meta.discourse.org/t/how-to-disable-link-click-counters/292791)._
