Question: Do search engines read information contained in JavaScript variables, the page head, and in the page body? Do search engines follow JavaScript links?
Shari’s Answer:
These are a great set of questions because they introduce a topic that should be addressed: search engine “mythology.” In the field of search engine marketing, one common myth is that all web site owners should put keywords into every HTML tag possible in the event that any search engine reads that tag, an attribute of an HTML tag, and even JavaScript variables.
Let’s look at some examples.
HTML Attributes
In HTML, an attribute contains information about the data in a tag but is not the actual data itself. For example, suppose your web site contains a graphic image of the company logo on every page. The following image tag contains five attributes:
<img src=”images/logo.gif” width=”200″ height=”50″ alt=”Company logo” id=”logo” />
1. img is the HTML code that tells the browser to insert a graphic image into a web page.
2. src is the attribute that indicates the file name and location of the graphic image. In this example, the name of the company logo is “logo.gif, and the company logo image is located in a subdirectory named “images.”
3. height and width are also attributes. They are the logo’s dimensions, measured in pixels.
4. alt is the alternative text attribute. Alternative text appears in the place of a graphic image if the image does not load or if site visitors are using a text-only browser.
5. id assigns a name to an element, and this name must be unique. In this example, the image element has been assigned the unique id called “logo”. This attribute is necessary for most JavaScript mouseovers to work.
To determine relevancy, some search engines will index and place some emphasis on the text inside of the alternative text attribute. Search engines do not place emphasis on the text inside of the id attribute.
The reason that search engines place little or no emphasis on these attributes is quite simple – potential spam problems. In the past, many unscrupulous search engine marketers try to stuff keywords into graphic images that have little or nothing to do with the actual content on a page.
Web developers can name an id attribute anything they wish. If they want to name it with a keyword (because it makes sense to do so), they can do so. Likewise can also place the word “sex” inside an id attribute of a children’s toy site in the hopes that the word “sex” will increase their site’s search engine visibility.
I know this example is extreme, but I use it to make a point. Too many unscrupulous search engine marketers stuff unrelated or repetitive keywords in different attributes. To combat this type of spam, engineers program the search engines to ignore the content in these attributes.
JavaScript Variables and Links
In JavaScript, a variable contains a value. For example, if a company sells tea, a variable called CompanyName might be assigned the string “tea”. Another way to write this is CompanyName=”tea”. The variable “CompanyName” now contains the value “tea”.
Since “tea” is obviously a keyword for this type of company, it would be great if the search engines will give a keyword boost for keywords in JavaScript variables. Unfortunately, they do not.
JavaScript links can be quite problematic. One of the most common uses for JavaScript links are pop-up windows and redirects. In all honesty, most pop-up windows contain sales-and-marketing hype; therefore, the content is of very little use to the search engines. Some JavaScript links can get search engine spiders “trapped” in infinite loops and crash the spider. So search engines greatly limit the types of JavaScript links they will follow.
Text between the <head></head> and <body></body> tags
All of the search engines read the text in between the <head></head> and <body></body> tags. What’s important to remember is to focus your optimization efforts on primary text versus secondary text.
Primary text refers to the text that all of the search engines index and use to determine relevancy. In between the <head> and </head> tags, the only text that has major emphasis is the <title> tag.
In between the <body> and </body> tags, the most important text is the text that can be copied and pasted directly from your browser into a text editor. Examples of these tags include paragraphs, headings, ordered lists, and unordered lists. Text at the top of the page tends to get greater emphasis than text at the bottom of a page.
Secondary text refers to the text that some of the search engines index and use to determine relevancy. Examples of secondary text include meta tags and alternative text.
All search engine marketers and web site owners should focus their efforts on primary text because modifying that text will have the greatest impact on search engine visibility.
Conclusion
In the quest for top search engine visibility, many web site owners search for the secret trick or gimmick that will make their sites rank higher than their competitors’ sites. They stuff keywords inside of every tag, attribute, and variable imaginable. These tricks and gimmicks fall under search engine “mythology” because using these gimmicks alone will not get a site top search engine visibility.
Do not spend too much time relying on tricks and gimmicks rather than focusing building on a strong foundation. Focus your efforts on primary text and building quality links to your site.
Shari Thurow is Marketing Director at Grantastic Designs, Inc., a full-service search engine marketing, web and graphic design firm. This article is excerpted from her book, Search Engine Visibility (http://www.searchenginesbook.com) published in January 2003 by New Riders Publishing Co. Shari can be reached at shari@grantasticdesigns.com.
Shari Thurow Answers SEO Questions: Click Here For Free Answers