Dusty
Dusty

Reputation: 1083

Google Custom Search Query Parameters and Category Parameters

So I'm trying to set the query parameters and category parameters for google custom search. Here is an example search results page url:

http://www.whiterootmedia.com/search_results/index.html?q=my%20search%20phrase

So it looks like the default query parameter is q so I put q in the box when setting up the analytics portion for my google custom search engine. Is this ok? I read it wasn't ok to use q but to instead use query? And why does it matter?

Also should I set a category parameter that looks to be optional.

Thanks, Dusty

Upvotes: 6

Views: 11858

Answers (3)

Schwolop
Schwolop

Reputation: 41

You can hit the following: https://cse.google.com/cse?as_q=your_query_string%20must_be_urlencoded&client=google-csbe&cx=full_cse_id_goes_here:including_the_bit_after_the_colon

So a direct answer to your question - the query parameter key is 'as_q'.

Upvotes: 1

KrisWebDev
KrisWebDev

Reputation: 9492

HTML:

<gcse:search gname='google1'></gcse:search>

Javascript:

window.google.search.cse.element.getElement("google1").execute("hello world");

But you need to wait for the Google script to load before launching the javascript.

If you use searchresults-only instead of search, you also need to enable the correct layout in the CSE Control Pannel: https://www.google.com/cse/

Upvotes: 1

perNalin
perNalin

Reputation: 161

The Google Search API just uses q. AFAIK the API doesn't have a query parameter. Check out the custom search API documentation.

Not sure what you mean by the 'category' parameter. Haven't come across that one before.

Upvotes: 1

Related Questions