[thelist] Tracking Webpages

Sam sam at sam-i-am.com
Fri Feb 15 10:38:01 CST 2002


>
> I know it's possible to get the referring url for a page BUT is it possible
> and if so how to get the keywords submitted to a search engine which brought
> the user to the site?

Are you wanting to do log analysis, or are we talking about client-side
scripting? In javascript, there's no document.referrer.keywords and
there's no KEYWORDS environment variable or anything like that. The
referring url should however contain those keywords (using it was a GET
and not a POST). So e.g this from my logs:
(will wrap, ip anonomized)

 127.0.0.1 - - [15/Feb/2002:11:02:39 -0500] "GET
/testsuite/measuring/rulers.html HTTP/1.1" 200 198 sam-i-am.com
"http://www.google.com/search?hl=en&q=screen+rulers&btnG=Google+Search"
"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"

the referer is:
http://www.google.com/search?hl=en&q=screen+rulers&btnG=Google+Search

i don't need a fancy parser to tell me that someone searched google for
screen rulers and clicked through to /testsuite/measuring/rulers.html

But doing this programmatically and for any number of potential search
engines and referers is trickier. All the search engines will format the
query string slightly differently, so it could be a lengthy and
thankless task reliably extracting them. But for a quick glimpse at what
kind of keywords are finding your site you could just look for google
referrers and parse those more easily.

does that help?

Sam



More information about the thelist mailing list