Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to set up a custom search ad, but I am nost sure about the query.

On the site it says:

'query' should be dynamic based on your page. This variable targets the ads and therefore should always match what the user on your site has just performed a search for.

Now, what I understand is: I have to program my page so that the query variable contains some custom words. Am I right?

If a user gets to my site through clicking on an AdSense, there is no way to "know" what the user looked for and display my query accordingly, right?

share|improve this question
How did you get this to work? Anyone get it to work with Wordpress? – user32035 Oct 16 '13 at 15:56

Can you post a link to your site so I can answer better?

Custom search ads are intended for search engines. Is your site a search engine? If so, it should have a query box, which you should integrate into the code.

If your site is not a search engine, then you should use regular adsense.

Have you applied and been approved for Adsense custom search ads? Using it requires special approval per site.

share|improve this answer
up vote 0 down vote accepted

I found out the answer, and it it yes, you have to program your javascript to grab the search parameters and put them into the "query" variable inside the adsense code!

share|improve this answer

Your Answer


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.