AdWords
1.6K members online now
1.6K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

Extract search query information

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

I'm trying to extract the precise search query a visitor used to reach my website through an AdWords ad. I'm using JavaScript and would like to use that information in real time (to display the query in the website, use it in an online chat, etc.).

 

I tried using document.referrer in JavaScript for this, extracting the 'q' parameter. But this does not always work.  Sometimes, the document.referrer is something like "www.google.com?q=i+need+blue+widgets", which is useful. However, on other ocassiones, the document.referrer will just be "www.google.com".

 

Is there any surefire way to obtain this info? I'm only interested in doing this for visitors that come through my ads, so I don't care if the solution does not work for organic clicks.

 

Thank you very much!

2 Expert replyverified_user
Marked as Best Answer.
Solution
Accepted by MosheTLV (Top Contributor)
September 2015

Re: Extract search query information

Top Contributor
# 2
Top Contributor

You'll need to add the dynamic keyword parameter to the URL and pull it from the URL on your site using whatever method you like. 

 

http://certifiedknowledge.org/blog/using-adwords-dynamic-parameters-in-links/

Re: Extract search query information

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you very much!

 

I have one question about this, though: if I add this query string to my URLs, will Google reset my AdWords data, as if I were changing the destination URL?

Re: Extract search query information

Top Contributor
# 4
Top Contributor

Yes. Unfortunately it will.

 

You're best bet is to make the change when you're changing out your ads for better performing ones. 

 

We do this on a weekly cycle or depending on volume. CONSTANTLY testing new ad copy. Simply fit the destination URL change into this rotation. Sorry, there's no other way around it I'm afraid.

Re: Extract search query information

Top Contributor
# 5
Top Contributor

Hi pitzulina,

 

I hardly ever disagree with Dave, but this time I feel I must.

 

The reason you would get some hits from google without the query data is when the user uses https to do the search. In that case you will not see the query in the referrer data--and you won't see the query in Analytics either. There's just no way to see the actual searh query when the user is in secure mode.

 

Using DKI inserts the keyword on which you bid that was triggered buy the search query. The {keyword} value does the same thing. Neither will help you find the actual search query.

 

There is no "sure fire" way to get this info since the advent of secure search.

 

Best of Luck!

 

Pete

 

petebardo -- Deadhead doing AdWords