Showing posts with label seo. Show all posts
Showing posts with label seo. Show all posts

Tuesday, March 02, 2010

Google Keyword Competition Script

In addition to web development, I also do my fair share if Internet marketing and Search Engine Optimization consultation. One of the methods at the core of SEO is keyword research. There are plenty of tools out there for doing keyword research - Micro Niche Finder, Keyword Elite, Market Samauri, just to name a few - but I prefer to do it myself using the Google Adwords Keyword Tool (GAKT) and Google search.

I use GAKT to identify likly keywords related to whatever market I'm researching, and I then go straight to Google to check:

Broad competition (total number of results on a search performed without quotes)
Exact competition (total number of results on a search performed with quotes around the keyword)
AllInUrl (allinurl:keyword)
AllInTitle (allintitle:keyword)
AllInAnchor (allinanchor:keyword)
AllInText (allintest:keyword)

These searches bring back numbers that let me evaluate the competetiveness of the keyword - that is how easy it might be to get well ranked in Google's results.

As you can imagine, typing all that is a pain, so just yesterday I wrote a little ASP script that goes out and gets all the info for you:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Google Keyword Competition Stats </TITLE>
<style type="text/css">
body {font: normal 12pt arial}
</style>
<!--
If would be nice if you left in the below, but if you get some sort of savage glee by deleting it, then have at it.
Script by Dave, AKA Wedango on the WarriorForum
ASP blog: http://retrowebdev.blogspot.com/
He also does web sites and stuff: Webdango.com
-->
</HEAD>

<BODY>
Enter Your Keyword
<br><br>
<FORM METHOD=POST ACTION="goog-stats.asp">
<INPUT TYPE="text" NAME="keyword">
<INPUT TYPE="submit">
</FORM>
<%
Dim strKeyword

strKeyword = ""
strKeyword = Trim(Request.form("keyword"))

If strKeyword <> "" Then
Dim objXMLHTTP, strURL, iBroadComp, iExactComp, iAllInURL, iAllInTitle, iAllInAnchor

Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")

Response.write("Results for <b>"&strKeyword&"</b><br><br>")
'broad competition
Response.write("Broad Competition: "& fKeywordStats("broad",strKeyword) &"<br>")

'exact competition
Response.write("Exact Competition: "& fKeywordStats("exact",strKeyword) &"<br>")

'allintitle
Response.write("All In Title: "& fKeywordStats("allintitle",strKeyword) &"<br>")

'allinurl
Response.write("All In URL: "& fKeywordStats("allinurl",strKeyword) &"<br>")

'allinanchor
Response.write("All In Anchor: "& fKeywordStats("allinanchor",strKeyword) &"<br>")

'allincontent
Response.write("All In Text: "& fKeywordStats("allintext",strKeyword) &"<br><br>")

Set objXMLHTTP = nothing
End If
%>

<%
Function fKeywordStats(TheType, TheKeyword)
Dim strURL, strHTML, vStart, vEnd, vLength

vStart = 0
vEnd = 0
vLength = 0

Select Case TheType
Case "broad"
strURL = "http://www.google.com/search?hl=en&q="&strKeyword&""
Case "exact"
strURL = "http://www.google.com/search?hl=en&q="""&strKeyword&""""
Case "allinurl"
strURL = "http://www.google.com/search?hl=en&q=allinurl%3A"&strKeyword&""
Case "allintitle"
strURL = "http://www.google.com/search?hl=en&q=allintitle%3A"&strKeyword&""
Case "allinanchor"
strURL = "http://www.google.com/search?hl=en&q=allinanchor%3A"&strKeyword&""
Case "allintext"
strURL = "http://www.google.com/search?hl=en&q=allintext%3A"&strKeyword&""
End Select

objXMLHTTP.Open "GET", strURL, false
objXMLHTTP.Send
strHTML = objXMLHTTP.responseText

vStart = Instr(strHTML,"</b> of about <b>") + 17
vEnd = Instr(strHTML,"</b> for <b>")
vLength = vEnd - vStart

If vStart > 17 then
strHTML = Mid(strHTML,vStart,vLength)
Else
strHTML = "no results"
End If

fKeywordStats = strHTML
End Function
%>
</BODY>
</HTML>


The script has to be run on a Windows server with the Microsoft.XMLHTTP object enabled.

Name the script goog-stats.asp. If you name it something different, you have to change the name in the FORM ACTION value.

Happy keyword hunting!

Wednesday, September 20, 2006

Black Hat SEO: How to get Inbound Links from Authority Sites

In this article I'm going to talk about a black hat SEO method of getting inbound links from authority sites.

DISCLAIMER
If you decide to use the methods and techniques explained below, know that you could incur search engine penalties or even outright banning. I present this information for educational purtposes only, and to assist webmasters who are constructing sites and want to prevent this from happening to them.

It's no secret that inbound liks exert a strong influence on a site's ranking. An inbound link from a well-respected authority site is very valuable, especially when such a site is an .edu or .gov. But getting links from these sites is next to impossible.

Or is it?

HTML injection is the technique of including HTML code when filling out a form. By so doing, it's sometimes possible to get the targeted site to do or display something 'out of the ordinary'. Using HTML injection techniques, unscrupulous individuals can insert code that results in the display of links to other sites, along with some key words.

For the purposes of this example, I'll use a .edu site:
http://cluster.space.swri.edu/
This site uses a search application called WebGlimpse. Glimpse stands for GLobal IMPicit SEarch and is an indexing and query application. At the bottom of the page, you can see the form for entering a search into their WebGlimpse application. While newer versions of Glimpse have been updated to account for HTML injection, there are plenty of sites out there still using older verions.

Here's where HTML injection comes in. Cut and paste the following into the search box, execute the search, and see what happens:
%22%3E%3Ca+href%3Dhttp%3A%2F%2Fwww.widgets.com%3EGreat+Widgets%3C%2Fa%3E+widgets+are+great
If you URL decode this you get:
"><a+href=http://www.widgets.com>Great+Widgets</a>+widgets+are+great
What you end up with on the results page is a link to www.widgets.com, along with whatever keywords you appended to the end of the search string. Look in the address bar; you'll see that the address contains the search string you just typed in (along with some other stuff):
http://cluster.space.swri.edu/cgi-bin/webglimpse/public/web?query=
%2522%253E%253Ca%2Bhref%253Dhttp%253A%252F%252Fwww.widgets.com%253EGreat%2B
Widgets%253C%252Fa%253E%2Bwidgets%2Bare%2Bgreat
&errors=0&age=&maxfiles=50&maxlines=30
Trimming the variables results in:
http://cluster.space.swri.edu/cgi-bin/webglimpse/public/web?query=
%2522%253E%253Ca%2Bhref%253Dhttp%253A%252F%252Fwww.widgets.com%253E
Great%2BWidgets%253C%252Fa%253E%2Bwidgets%2Bare%2Bgreat
Cut and past this into your browser and you get the search results page directly. So, in theory, you could put this out as a link somewhere, search engine spiders would follow it to the WebGlimpse page, then follow that link to... well, wherever you had it pointing.

Many times the WebGlimpse search isn't readily accessible. In that case, you'll need to play detective to figure out how to build the URL.

Here's an URL decoder/encoder.

Remember - he (or she) who flys above the radar gets shot down.

Friday, September 08, 2006

WWW Versus Non-WWW URLs: Dupe Content and Redirecting

I'm not real clear on the technical reasons behind it all, but the consensus in the SEO community is that it's detrimental because of duplicate content penalities to have your web site operating on both the www and non-www addresses. Ideally, you should pick one address or the other and have visitors (human and otherwise) who come to the other forwarded using a permanent redirect. So if you choose www.YourSite.com as your web web address, you should have all visitors to Your.Site.com forwarded to www.YourSite.com.

This is easy enough to do for one page, but how about some handy code that will automatically forward all your pages using a search engine friendly 301 redirect?

This code that will forward any visitor to the www version of your site, no matter what the entry page. Place this code at the top of every page:

<%
Dim strDomain, strURL, strQueryString, strHTTPPath,vTempNum

'Get page domain
strDomain = LCase(request.ServerVariables("HTTP_HOST"))

'Check for www
If Left(strDomain, 3) <> "www" Then
strHTTPPath = Request.ServerVariables("PATH_INFO")

'If page is default.asp, send to root
If right(strHTTPPath, 12) = "/default.asp" Then
vTempNum = Len(strHTTPPath)-11
strHTTPPath = Left(strHTTPPath,vTempNum)
End If

'If page is index.asp, send to root
If right(strHTTPPath, 10) = "/index.asp" Then
vTempNum = Len(strHTTPPath)-9
strHTTPPath = Left(strHTTPPath,vTempNum)
End If

'Set the new URL
strQueryString = Request.ServerVariables("QUERY_STRING")
strURL = "http://www." & strDomain & strHTTPPath

'If any, pass on query string variables
If len(strQueryString) > 0 Then strURL = strURL & "?" & strQueryString

'301 Redirect to www version
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", strURL
End If
%>
Likewise, here is code that will redirect to the non-www version:

<%
Dim strDomain, strURL, strQueryString, strHTTPPath,vTempNum

'Get Page domain
strDomain = lcase(request.ServerVariables("HTTP_HOST"))

'Check for www
If Left(strDomain, 3) = "www" Then
'Change to non-www version
vTempNum = Len(strDomain)-4
strDomain = Right(strDomain,vTempNum)
strHTTPPath = Request.ServerVariables("PATH_INFO")

'If page is default.asp, send to root
If right(strHTTPPath, 12) = "/default.asp" Then
vTempNum = Len(strHTTPPath)-11
strHTTPPath = Left(strHTTPPath,vTempNum)
End If

'If page is index.asp, send to root
If right(strHTTPPath, 10) = "/index.asp" Then
vTempNum = Len(strHTTPPath)-9
strHTTPPath = Left(strHTTPPath,vTempNum)
End If

'Set new URL
strQueryString = Request.ServerVariables("QUERY_STRING")
strURL = "http://" & strDomain & strHTTPPath

'If any, pass on query string variables
if len(strQueryString) > 0 Then strURL = strURL & "?" & strQueryString

'301 redirect to non-www version
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", strURL
End If
%>

Thursday, September 07, 2006

Scraping Search Engines for Page Content

It's no secret that optimized page content can help you rank better in organic search engine results. While page content is not the deciding factor, it's stil important, especially for long tail search terms. No matter what your page content, you're probably not going to be able to rank well for the term 'dvd player' (or any other exceptionally competetive term). But you might be able to rank on a long tail term such as 'panasonic portable dvd player model 123ABCxyz'. For such a long tail phrase, optimized page content can help.

But how to get the content? Well, you could write it. Or buy it. Or... scrape it from somewhere else.

If you chose the scraping solution, I highly recommend that you have some original content on the page. Write a capsule review, or your own description, or anything else that likely doesn't exist on some other site (until, of course, someone scrapes it).

The following process will step you through scraping content from a search engine and adding it to your page.

WARNING: Implementing these techniques could very well get you banned from the search engines!

1. Decide on the keyword you want to generate content for. For this example, I'll use the fictitious Panasonic DVD model from above.

2. Decide how many search engines you're going to scrape content from. For this example, I'll use 3: MSN, Yahoo, and Gigablast.

3. Since I'm using 3 search engines, I generate a random number between 1 and 3.

4. Now pass the number into a page scraping function to go out and get the search results for that phrase from the search engine. The way you might do it is pass the number and keyword into the function:
strContent = ScrapeContent(intRandNum,"panasonic portable dvd player model 123ABCxyz')
Then, in the function, have a Case statement to assign the url based on the random number:
Function ScrapeContent(TheEngine, TheTerm)
Select Case TheEngine
Case 1
URL = "http://search.msn.com/results.aspx?q="&TheTerm&""
Case 2
URL = "http://search.yahoo.com/search?p="&TheTerm"&"
Case 3
URL = "http://www.gigablast.com/search?q="&TheTerm&""
End Select

Set xmlObj = Server.CreateObject("MSXML2.ServerXMLHTTP")

xmlObj.Open "GET", url, true
Call xmlObj.Send()

On Error Resume Next

If xmlObj.readyState <> 4 Then xml.waitForResponse 3

If Err.Number <> 0 Then
ScrapeContent = "There was an error retreiving the remote page"
Else
If (xmlObj.readyState <> 4) Or (xml.Status <> 200) Then
xmlObj.Abort
ScrapeContent = "Problem communicating with remote server..."
Else
ScrapeContent = xmlObj.ResponseText
End If
End If
End Function
5. In the above example. we know have the remote content assigned to a variable named strContent. Parse that string to strip out eveything between the body tags:
strContent = Mid(strContent,Instr(strContent,"<body>")+6,Instr(strContent,"</body>"))
6. Now that you have the body content, replace all the breaks with a space; this is because words might run to gether otherwise:
strContent = Replace(strContent,"<br>"," ")
7. There are some extraneous words that have no relevancy to your search term that you're probably going to want to strip out as well. For example, Yahoo has additional links that follow the listing: 'Cached', 'More from this site', 'Save' etc. I recommend customizing a function to strip out all the non keyword related carp that clutters the search results you just scraped.

8. Now you have fairly clean copy relevant to your keyword, the last thing to do strip out the HTML.

The end result: a big chunk of text directly relevant to your keyword.

There's a few things you can do with it: plop it right on the page (not recommended), hide it in a div, or - my recommendation - hide it in a div and reverse cloak it, so that only search engines can see it. Hopefully your pages will start climbing higher in the organic results.

Leverage those favorable results quickly! Sooner or later you'll find your site banned, either because the spiders got smarter or a competitor reported you.

Good luck!

Thursday, August 31, 2006

How to Cloak Page Content from Seach Engine Spiders

Cloaking is the term used to describe showing different content depending on who your visitor is. Don't confuse cloaking with hidden text; hidden text is hiding it from view, cloaking is not even loading it into the page.

There are some legitimate uses of cloaking, like disabling features that might not be cross browser compatible, or showing different news headlines based on the geo-location of the visitor to your web site.

The most reknowned use of cloaking, however, is in relation to attempts to manipulate a web sites ranking in search engine results by showing the search engine spiders one thing (usually highly optimized keyword content) and showing visitors something else. Webmasters might add or not show content in the hopes that their site will rank better in organic results.

Here's a fairly simple way to cloak content so it gets seen by search engine spiders but not by human visitors. You might, for example, place this snippet at the bottom of the page. Or you can see my post in hiding web site content and put the cloaked content in a div that is styled to keep it hidden from view:
<%
Dim strUA, vShowIt

strUA = LCase(request.servervariables("HTTP_USER_AGENT"))

vShowIt = 1
If InStr(strUA,"google") <> 0 Then vShowIt = 0
If InStr(strUA,"msnbot") <> 0 Then vShowIt = 0
If InStr(strUA,"yahoo") <> 0 Then vShowIt = 0
If InStr(strUA,"inktomi") <> 0 Then vShowIt = 0
If InStr(strUA,"snapbot") <> 0 Then vShowIt = 0
If InStr(strUA,"irlbot") <> 0 Then vShowIt = 0
If InStr(strUA,"turnitinbot") <> 0 Then vShowIt = 0
If InStr(strUA,"cjnetwork") <> 0 Then vShowIt = 0
If InStr(strUA,"myfamilybot") <> 0 Then vShowIt = 0
If InStr(strUA,"geniebot") <> 0 Then vShowIt = 0
If InStr(strUA,"wiki") <> 0 Then vShowIt = 0

If vShowIt = 0 Then
%>
Cloaked Content Here
<%
End If
%>
So if vShowIt = 0, that means the visitor was one of the bots you checked for, and you want to show the content. You could reverse it as welll by checking to see if vShowIt = 1, you could hide content from search engine spiders. This could be useful for putting links on apage that you want human visitors to see, but not search engines.

A more advanced way of cloaking is to cloak based on IP. There are service you can subscribe to that will provide you wil updated lists of all the IPs search engine spiders originate from. Cloaking based on those IPs is more reliable than simply checking the User Agent name.

Now you're probably asking, "How can someone detect cloaked content?"

The search engine sees the cloaked content, so if the webmaster didn't hide it as well, you can see the cloaked content when you view a cached snapshot of the page. This is why some webmasters use the "no-cache" parameter in the meta tags to keep the page from being cached.

Another way is to use a browser that lets you impersonate a different User Agent. WANNABrowser lets you do just that. Type Google or MSN or Yahoo in the HTTP User Agent field and then the url of the page you want to view.

Cloaking had it's heyday when page content was the main driver of search engine rank. Although it can still be useful, for both legitimate and shady purposes, it's not nearly the tool it used to be for driving major ranking changes in search engine results.

Wednesday, August 30, 2006

Scraping Page Content from a Remote Site in ASP

Scraping page content (called consuming when you do it to an RSS feed) is a way of getting content from a site other than your own and then displaying it on your own site (typically as your own content). Since the scraping is performed by the server, not the client, it has the appearance - to both site visitors and search engine spiders alike - of having originated from YOUR site, not the one you scraped from.

Microsoft's suite of XML DOM (Document Object Model) components includes the XMLHTTP object. This object was originally designed to provide client-side access to XML documents on remote servers through the HTTP protocol. It exposes a simple API which allows you to send requests (even POSTS) and get the resultant XML, HTML or binary data.

The code below shows how to return the HTML of a remote URL. Note there are two options for instaniating the object: one uses Microsoft.XMLHTTP and the other MSXML2.ServerXMLHTM. The second is the newer version of the object. Try using the older one first and if that one doesn't work, try the newer.

Since this functon returns served content, you can use it for any type of page: asp, aspx, php, html, htm... etc. Built as a function, you could go with something like:

strURL = "http://www.TheSite.com/ThePage.aspx"
strRemoteContent = GetRemoteContent(URL)

Function GetRemoteContent(TheURL)
'create an instance of the MS XMLhttp component.
'this is the old version, use new if you can
'Set xmlObj = Server.CreateObject("Microsoft.XMLHTTP")

'new version, better
Set xmlObj = Server.CreateObject("MSXML2.ServerXMLHTTP")

'Open the connection and send the request
'Set the optional Async parameter to True
'Otherwise, the waitForResponse method used will have no effect
xmlObj.Open "GET", url, true
Call xmlObj.Send()

'Turn off error handling
On Error Resume Next

'Wait for up to 3 seconds if we've not gotten the data yet
If xmlObj.readyState <> 4 Then xml.waitForResponse 3
'Did an error occur? If so, use a default value for our data
If Err.Number <> 0 Then
GetRemoteContent = "There was an error retreiving the remote page"
Else
'If we reach here, we know the server responded
'To accommodate for unexpected behaviors ensure the
'readyState property equals 4
'and the Status property, which returns the HTTP Response status,
'equals 200
If (xmlObj.readyState <> 4) Or (xml.Status <> 200) Then
'Abort the request
xmlObj.Abort
GetRemoteContent = "Problem communicating with remote server..."
Else
GetRemoteContent = xmlObj.ResponseText
End If
End If
End Function
Now the thing you have to remember is that this brings back the entire page, so if there's content on the page you want to use, you should parse it out. At a minimum, you probably only want the content between the opening and closing BODY tags. YOu could create a funciton to pull that out and display it:

response.write(ParseContent(strRemoteContent))
Function ParseContent(TheContent)
intStart = INSTR(LCASE(strRemoteContent,"<body>")) + 6
intEnd = INSTR(LCASE(strRemoteContent,"</body>"))
intLength = intEnd - intStart
ParseContent = MID(strRemoteContent, intStart, intLength))
End Function
You can do more parsing inside the funciton or extract other content by using the various string functions of VBScript. You could have different functions that pull out different sections of teh remote page for display.

Although page scraping might seem to be more for content stuffing or other less than savory ends, there are many legitmate uses as well: grab the newest news headlines or stock prices, do a price check, see if a page has been updated.... Combined with an XSLT style sheet, it can be used to pull in RSS feeds too.

Be aware that this only works on Windows servers and that that some hosting companies disable the XMLHTTP object. If you're going to build a site that makes heavy use, check with your hosting company first to make sure they have it enabled.

Monday, August 28, 2006

SEO and the Title Tag

The Title Tag not only communicates the theme of your web page to the human visitors but is also considered very important by the Search Engine crawlers. The Title Tag is the most important of all Tags. Almost all crawler based search engines use the Title Tag to gather information about the page. Search engines use your Title Tag to evaluate the page's relevance to its content, inbound links, outbound links, alt tags, and a host of other factors. A carefully constructed Title Tag can have a large positive impact on your page's ranking with the search engines.

In addition, the Title Tag is often the hyperlinked text title that is displayed in the search engine results page. This is the hyperlink a user clicks on to go to your web site. The Title Tag is also used as the text when you ‘bookmark' a page or add a certain web page to your ‘favorites' list in your browser.

Since the Title Tag plays a vital role in your site's ranking, you need to pay a lot of attention to the words that appear in the Title Tag and the order in which they appear. Put your important keywords at the beginning of the Title Tag. This can have the added benefit of making those words appear in bold in the search engines result pages. Develop a crisp Title Tag that includes your most relevant keyword phrases for that page. The keywords in the Title Tag are given a high value when it comes to the search engine trying to figure out what your page is about.

It's important to be highly focused. You should use the same keywords not just in your Title Tag, but also in your page content, Meta Description, and Meta Keywords Tags as well. If the keywords in your Title Tag don't appear in the page content, then avoid using them.

Specific Resources

From Google's Guidelines for Webmasters:

Design and Content Guidelines:

  • Make a site with a clear hierarchy and text links. Every page should be reachable from at least one static text link.

  • Offer a site map to your users with links that point to the important parts of your site. If the site map is larger than 100 or so links, you may want to break the site map into separate pages.

  • Create a useful, information-rich site, and write pages that clearly and accurately describe your content.

  • Think about the words users would type to find your pages, and make sure that your site actually includes those words within it.

  • Try to use text instead of images to display important names, content, or links. The Google crawler doesn't recognize text contained in images.

  • Make sure that your TITLE and ALT tags are descriptive and accurate.

  • Check for broken links and correct HTML.

  • If you decide to use dynamic pages (i.e., the URL contains a "?" character), be aware that not every search engine spider crawls dynamic pages as well as static pages. It helps to keep the parameters short and the number of them few.

  • Keep the links on a given page to a reasonable number (fewer than 100).



From MSN Webmaster Help

About your site description

As the MSN Search web crawler MSNBot crawls your site, it analyzes the content on indexed pages and generates keywords to associate with each page. Then MSNBot extracts page content that is highly relevant to the keywords (often sentence segments that contain keywords or information in the description meta tag) and constructs the site description displayed in search results. The page title and URL are also extracted and displayed in search results.

From Yahoo Search Help

Yahoo! Search ranks results according to their relevance to a particular query by analyzing the web page text, title and description accuracy as well as its source , associated links, and other unique document characteristics.


What Is a Title Tag?

The title tag is one of the most important factors in achieving high search engine rankings.

A title tag is essentially an HTML code snippet that creates the words that appear in the top bar of your Web browser.

The title tag belongs in the section of your source code, and is generally followed by your Meta description and Meta keywords tags. The order of these tags is not critical, so don't worry if your HTML editor places them in a different position.

Some Web site design tools and content management systems (CMS) automatically generate the title tag from information you provide. You may have noticed Web pages that are labeled "Page 1," "Page 2," or "Home Page" in the browser title bar. You'll often see titles like these being used by beginning Web site designers who simply don't know how to use their software or their title tag for maximum benefit.

Sunday, August 27, 2006

Hiding Page Content

Suppose a circumstance arises where - for whatever reason - you want to hide page content from human users but not search engine spiders.

The following code uses CSS to create two divs and then puts one div behind the other by using Z-Index. Human visitors to your site see the top div, search engine spiders see both. Be warned: users surfing in FireFox with CSS turned off will see all content as well.


<html>
<head>
<style type="text/css">
body
{
margin: 0px 0px 0px 0px;
}

#absdiv1
{
z-index: 5;
position: absolute;
width: 100%;
height: 75px;
background-color: #ffffff;
}

#reldiv2
{
z-index: 1;
position: relative;
width: 300px;
height: 75px;
}
</style>
</head>

<body>
<TABLE cellpadding=5 cellspacing=0 width="100%">
<TR>
<TD>
<div id="absdiv1">
This could the div with your header stuff in it,
or your logo in the upper left
</div>

<div id="reldiv2">
You can put all kinds of stuff in this div and no
one can see it; links, keywords, even images
</div>
</TD>
</TR>
</TABLE>
</body>
</html>