Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I want to track google search keyword for site in asp classic. Any user which use any word in google search to reach on my site, I want to track this word.

share|improve this question

migrated from stackoverflow.com Oct 28 '11 at 11:09

This question came from our site for professional and enthusiast programmers.

    
So you want to do it in ASP or JavaScript? –  alex Oct 28 '11 at 5:50
    
actually i want to track a user search a word(product name) in google, then he reached on my product site. i have to track that word and store it to db. yes in asp cllasic or javascript –  Arun Oct 28 '11 at 6:08

3 Answers 3

You could use Google Analytics for this.

share|improve this answer
    
actually i want to track a user search a word(product name) in google, then he reached on my product site. i have to track that word and store it to db. –  Arun Oct 28 '11 at 6:07

You can get the referring URL from the ASP Server object and parse out the search term from the string.

The problem with doing this is that Google is going to remove referrer information from some searches. See this link for more info on the change: http://www.seroundtable.com/google-ssl-drops-query-data-14188.html

share|improve this answer
    
thx for good help –  Arun Nov 4 '11 at 10:28

You should be looking at the referer header in the HTTP request and see if your user was coming from the Google search engine. You could match it against a regular expression to match any google domain:

(www\.)?google\.[a-z]{2,4}

If it does, you can extract the query string parameters from the referer and look for the q parameter. It's value will be the search term the user used before it clicked on the link to your site.

You can get the referer header in ASP with:

Request.ServerVariables("HTTP_REFERER")

(and yes, it's "referer", famously spelled incorrectly)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.