大网数据广告活动
网站运营与故障问答

Tradeoffs of including alt attribute in tracking pixel

· 52CE 我爱测

I work at a company with a very prolific tracking tag, which uses a tracking pixel to pass information. Currently, our tag uses a bare <img> inside of a <noscript> , and the image does not have an alt attribute. Our SEO wants to …

问题原文

原帖链接 · Robert · CC BY-SA 3.0

I work at a company with a very prolific tracking tag, which uses a tracking pixel to pass information. Currently, our tag uses a bare <img> inside of a <noscript>, and the image does not have an alt attribute.

Our SEO wants to add an alt with some keywords to the tracking pixel, but I noted that the Facebook and Google pixels do not do this. I'm unable to justify my resistance to making this change besides a strong gut-feeling and comparison to competitors.

Is there any technical or SEO reason why this would be a bad idea? Have Facebook and Google simply overlooked this, or perhaps they're aware it offers no benefit - but wouldn't do any harm either.

I did note a few older threads discussing that all images should have an alt and that in the case of tracking pixels, an empty alt would be most appropriate. However, neither FB nor Google have an alt at all.


This question is not about how to track users on our site. My company is providing the tag that others use for their tracking. We're the second most prolific web tag behind Google Analytics. If I add an alt attribute, it will be included across all websites who install our tag moving forward. This is not about adding an alt attribute to a single tag on our own website.

社区高分解答

原帖链接 · unor · CC BY-SA 3.0

The answer from the HTML perspective

  1. Almost every img element must have an alt attribute.

    Almost, because there are two exceptions: under certain conditions, if figure is involved, and if a markup generator is unable to obtain a suitable alt value from the author. But these exception don’t apply to your case.

  2. In your case, the alt content must be empty, because the image is not intended for your visitors (i.e., it’s not relevant content).

    The alt guidelines in the HTML spec mention a case like yours:

    If an img element is being used for purposes other than showing an image, e.g., as part of a service to count page views, use an empty alt attribute.

The answer from the SEO perspective

It should have no relevance to SEO, as search engines would have no reason to be interested in tracking pixels. Unless, of course (like always), if you use it with bad intentions.

Adding keywords to the tracking pixel’s alt content would certainly be such a bad intention.

There is no good reason why this should be done (it goes against the HTML spec, it’s bad for accessibility, it serves no purpose for your human visitors), instead it smells like keyword stuffing. While it’s probably safe to assume that most search engines don’t fall for this anymore, this doesn’t make it okay or safe to do.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2017-05-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。