cedivad
cedivad

Reputation: 2644

Extract search engines' keywords with javascript and HTTP referer

I can't find anything googling. How can I extract search engine keywords for traffic sent to my website using javascript?

I don't want to reinvent the wheel, I'm looking for something that already exists, a tested library, however I can't find it.

Upvotes: 2

Views: 3647

Answers (1)

daveb
daveb

Reputation: 76211

As an answer, rather than just a comment. Your javascript code will need to inspect document.referrer (This may have been the magic keyword missing from your search).

Different search engines use different parameter names for the query, so you will need to know what to look for. Google uses q Yahoo! appear to use pqstr. Look for the value of that parameter in the referring url, and unencode it (with unencodeURIComponent).

However, there is still this answer to check out.

Upvotes: 5

Related Questions