问题原文
原帖链接 · 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
Almost every
imgelement must have analtattribute.Almost, because there are two exceptions: under certain conditions, if
figureis involved, and if a markup generator is unable to obtain a suitablealtvalue from the author. But these exception don’t apply to your case.In your case, the
altcontent must be empty, because the image is not intended for your visitors (i.e., it’s not relevant content).The
altguidelines in the HTML spec mention a case like yours:If an
imgelement is being used for purposes other than showing an image, e.g., as part of a service to count page views, use an emptyaltattribute.
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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
