How to get search keywords using javascript?

3.3k Views Asked by At

What I want to do is to track the keywords my visitors used in search to land on my page.

For example if you search for stackoverflow and then click on the link, I must be able to recognize using javascript that the user searched for stackoverflow

I tried using the document.referrer. The problem is that from https://www.google.co.in/search?q=stackoverflow&oq=stackoverflow&sugexp=chrome,mod=1&sourceid=chrome&ie=UTF-8

it redirects to http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCEQFjAA&url=http%3A%2F%2Fstackoverflow.com%2F form which I can't access the keywords.

Is there a way to get the previous URL?

0

There are 0 best solutions below