|
Collection search string used to find your site
I have just been answering a referer question and i thought hay, maybe someone may find this code i use, helpful.
this code will collect the search string a user used to find your site.
from the main players in search engines.
with this information, you know how people are finding you, and how to inprove that, so that you get to the top.
Code:
<%
StrFrom= TRIM(request.servervariables("HTTP_REFERER"))
StrFrom=lcase(StrFrom)
if instr(StrFrom,"google")<>0 then
searchEngine ="Google"
startfrom =instr(StrFrom,"q=")
if startfrom>0 then
startfrom=startfrom+2
ending =instr(startfrom+1,StrFrom,"&")
if ending=0 then
searchKeywords =mid(StrFrom,startfrom)
else
searchKeywords =mid(StrFrom,startfrom,ending-startfrom)
end if
end if
end if
if instr(StrFrom,"msn.com")<>0 then
searchEngine ="MSN"
startfrom =instr(StrFrom,"&q=&q=")
if startfrom>0 then
startfrom=startfrom+6
ending =instr(startfrom+1,StrFrom,"&")
if ending=0 then
searchKeywords =mid(StrFrom,startfrom)
else
searchKeywords =mid(StrFrom,startfrom,ending-startfrom)
end if
end if
end if
if instr(StrFrom,"altavista.com")<>0 then
searchEngine ="Altavista"
startfrom =instr(StrFrom,"q=")
if startfrom>0 then
startfrom=startfrom+2
ending =instr(startfrom+1,StrFrom,"&")
if ending=0 then
searchKeywords =mid(StrFrom,startfrom)
else
searchKeywords =mid(StrFrom,startfrom,ending-startfrom)
end if
end if
end if
if instr(StrFrom,"aol.co")<>0 then
searchEngine ="Aol"
startfrom =instr(StrFrom,"query=")
if startfrom>0 then
startfrom=startfrom+6
ending =instr(startfrom+1,StrFrom,"&")
if ending=0 then
searchKeywords =mid(StrFrom,startfrom)
else
searchKeywords =mid(StrFrom,startfrom,ending-startfrom)
end if
end if
end if
if instr(StrFrom,"mama.com")<>0 or instr(StrFrom,"mamma.com")<>0 then
searchEngine ="Mama"
startfrom =instr(StrFrom,"query=")
if startfrom>0 then
startfrom=startfrom+6
ending =instr(startfrom+1,StrFrom,"&")
if ending=0 then
searchKeywords =mid(StrFrom,startfrom)
else
searchKeywords =mid(StrFrom,startfrom,ending-startfrom)
end if
end if
end if
if instr(StrFrom,"yahoo.co")<>0 then
searchEngine ="Yahoo"
startfrom =instr(StrFrom,"p=")
if startfrom>0 then
startfrom=startfrom+2
ending =instr(startfrom+1,StrFrom,"&")
if ending=0 then
searchKeywords =mid(StrFrom,startfrom)
else
searchKeywords =mid(StrFrom,startfrom,ending-startfrom)
end if
end if
end if
if instr(StrFrom,"metacrawler.com")<>0 then
searchEngine ="MetaCrawler"
startfrom =instr(StrFrom,"web/")
if startfrom>0 then
startfrom=startfrom+4
ending =instr(startfrom+1,StrFrom,"&")
if ending=0 then
searchKeywords =mid(StrFrom,startfrom)
else
searchKeywords =mid(StrFrom,startfrom,ending-startfrom)
end if
end if
end if
if instr(StrFrom,"ask.com")<>0 then
searchEngine ="Ask.com"
startfrom =instr(StrFrom,"q=")
if startfrom>0 then
startfrom=startfrom+2
ending =instr(startfrom+1,StrFrom,"&")
if ending=0 then
searchKeywords =mid(StrFrom,startfrom)
else
searchKeywords =mid(StrFrom,startfrom,ending-startfrom)
end if
end if
end if
if instr(StrFrom,"vivisimo.com")<>0 then
searchEngine ="Vivisimo.com"
startfrom =instr(StrFrom,"query=")
if startfrom>0 then
startfrom=startfrom+6
ending =instr(startfrom+1,StrFrom,"&")
if ending=0 then
searchKeywords =mid(StrFrom,startfrom)
else
searchKeywords =mid(StrFrom,startfrom,ending-startfrom)
end if
end if
end if
end sub
%>
|