Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 569
Dusty Avatar asked Dec 12 '12 15:12

Dusty


2 Answers

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.

like image 188
perNalin Avatar answered Oct 02 '22 19:10

perNalin


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/

like image 38
KrisWebDev Avatar answered Oct 02 '22 17:10

KrisWebDev