Non nel ref passi direttamente la stringa di refer che leggerai da request.serverVariables("HTTP_REFERER")
in pratica fai in questo modo
codice:
ref=request.serverVariables("HTTP_REFERER")
ret=ChiaviRicerca (ref)
Response.Write ret & "
"
aggiunto anche il controllo se il refer non arriva da un motore di ricerca conosciuto
codice:
function ChiaviRicerca (ref)
Keywords=""
bfound=false
if InStr (1,ref,"google")>0 or InStr (1,ref,"altavista")>0 or InStr (1,ref,"search.msn") then
'Controllo per google, altavista e search.msn
'cerco la var q=
ref=mid(ref,InStr (1,ref,"q=")+2)
bfound=true
elseif InStr (1,ref,"yahoo")>0 then
'Controllo per yahoo
'cerco la var p=
ref=mid(ref,InStr (1,ref,"p=")+2)
bfound=true
end if
if bfound then
'Elimino eventuale stringhe dopo le keywords
if InStr (1,ref,"&")>0 then
ref=Mid (ref,1,InStr (1,ref,"&")-1)
end if
'creo array e stampo keyword
arrKeyword=split(ref,"+")
for i=0 to ubound(arrKeyword)
Keywords=Keywords & arrKeyword(i) & "
"
next
end if
ChiaviRicerca=Keywords
end function